枚举

jiayou  •  16天前


def f(n):
n = ','.join(n).split(',')
n.sort()

if n == ['1', '2', '3', '4','5', '6', '7', '8', '9']:

return True
else:
return False

for a in range(1,10):
for b in range(1,10):
for c in range(1,10):
for d in range(100,1000):
for e in range(100,1000):
if a+b/c+d/e ==10 and f(str(a)+str(b)+str(c)+str(d)+str(e)):
print(a,b,c,d,e,end=' ')
print()


评论: