Riekstiņš
Apr 21, 2006
Lūk, jums, jauks cietais rieksts! Kādu uzdevumu risina šī python programmiņa?
from operator import mul
def modder(x):
i = 0
while x:
i += 1
(x, remainder) = divmod(x, 2)
if remainder: yield i
for i in xrange(1, 2 ** 9):
set1 = set(modder(i))
set2 = set(range(1,10)) - set1
if sum(set1) == reduce(mul, list(set2), 1):
print str(set1)
print str(set2)
break