如题所述
这个随便列几个都可以吧,124,278,598。
126,453,421
for t in range(0, 3):
for i in range(1, 9):
for j in range(1, 9):
for k in range(1, 9):
if i+j+k == 10 :
for l in range(1, 9):
if l == i:
continue
for n in range(1, 9):
if n == j :
continue
for m in range(1, 9):
if m == k:
continue
elif l+n+m == 9:
for o in range(1, 9):
if o == l or o == i:
continue
for p in range(1, 9):
if p == n or p == j:
continue
for q in range(1, 9):
if q == m or q == k:
continue
elif o+p+q == 9:
# sse = {i, j, k, l, n, m, o, p, q}
# if len(sse) == 9:
# print((o * 100 + l * 10 + i, p * 100 + n * 10 + j,
# q * 100 + m * 10 + k))
print((o * 100 + l * 10 + i, p * 100 + n * 10 + j,
q * 100 + m * 10 + k))
elif l+n+m == 19:
for o in range(1, 9):
if o == l or o == i:
continue
for p in range(1, 9):
if p == n or p == j:
continue
for q in range(1, 9):
if q == m or q == k:
continue
elif o+p+q == 8:
# sse = {i, j, k, l, n, m, o, p, q}
# if len(sse) == 9:
# print((o * 100 + l * 10 + i, p * 100 + n * 10 + j,
# q * 100 + m * 10 + k))
print((o * 100 + l * 10 + i, p * 100 + n * 10 + j,
q * 100 + m * 10 + k))
elif i+j+k == 20:
for l in range(1, 9):
if l == i:
continue
for n in range(1, 9):
if n == j:
continue
for m in range(1, 9):
if m == k:
continue
elif l + n + m == 8:
for o in range(1, 9):
if o == l or o == i:
continue
for p in range(1, 9):
if p == n or p ==j:
continue
for q in range(1, 9):
if q == m or q == k :
continue
elif o + p + q == 9:
# sse = {i, j, k, l, n, m, o, p, q}
# if len(sse) == 9:
# print((o * 100 + l * 10 + i, p * 100 + n * 10 + j,
# q * 100 + m * 10 + k))
print((o * 100 + l * 10 + i, p * 100 + n * 10 + j,
q * 100 + m * 10 + k))
elif l + n + m == 18:
for o in range(1, 9):
if o == l or o == i:
continue
for p in range(1, 9):
if p == n or p ==j :
continue
for q in range(1, 9):
if q == m or q == k:
continue
elif o + p + q == 8:
# sse = {i,j,k,l,n,m,o,p,q}
# if len(sse) == 9:
#
# print((o * 100 + l * 10 + i, p * 100 + n * 10 + j,
# q * 100 + m * 10 + k))
print((o * 100 + l * 10 + i, p * 100 + n * 10 + j,
q * 100 + m * 10 + k))
126,453,421
for t in range(0, 3):
for i in range(1, 9):
for j in range(1, 9):
for k in range(1, 9):
if i+j+k == 10 :
for l in range(1, 9):
if l == i:
continue
for n in range(1, 9):
if n == j :
continue
for m in range(1, 9):
if m == k:
continue
elif l+n+m == 9:
for o in range(1, 9):
if o == l or o == i:
continue
for p in range(1, 9):
if p == n or p == j:
continue
for q in range(1, 9):
if q == m or q == k:
continue
elif o+p+q == 9:
# sse = {i, j, k, l, n, m, o, p, q}
# if len(sse) == 9:
# print((o * 100 + l * 10 + i, p * 100 + n * 10 + j,
# q * 100 + m * 10 + k))
print((o * 100 + l * 10 + i, p * 100 + n * 10 + j,
q * 100 + m * 10 + k))
elif l+n+m == 19:
for o in range(1, 9):
if o == l or o == i:
continue
for p in range(1, 9):
if p == n or p == j:
continue
for q in range(1, 9):
if q == m or q == k:
continue
elif o+p+q == 8:
# sse = {i, j, k, l, n, m, o, p, q}
# if len(sse) == 9:
# print((o * 100 + l * 10 + i, p * 100 + n * 10 + j,
# q * 100 + m * 10 + k))
print((o * 100 + l * 10 + i, p * 100 + n * 10 + j,
q * 100 + m * 10 + k))
elif i+j+k == 20:
for l in range(1, 9):
if l == i:
continue
for n in range(1, 9):
if n == j:
continue
for m in range(1, 9):
if m == k:
continue
elif l + n + m == 8:
for o in range(1, 9):
if o == l or o == i:
continue
for p in range(1, 9):
if p == n or p ==j:
continue
for q in range(1, 9):
if q == m or q == k :
continue
elif o + p + q == 9:
# sse = {i, j, k, l, n, m, o, p, q}
# if len(sse) == 9:
# print((o * 100 + l * 10 + i, p * 100 + n * 10 + j,
# q * 100 + m * 10 + k))
print((o * 100 + l * 10 + i, p * 100 + n * 10 + j,
q * 100 + m * 10 + k))
elif l + n + m == 18:
for o in range(1, 9):
if o == l or o == i:
continue
for p in range(1, 9):
if p == n or p ==j :
continue
for q in range(1, 9):
if q == m or q == k:
continue
elif o + p + q == 8:
# sse = {i,j,k,l,n,m,o,p,q}
# if len(sse) == 9:
#
# print((o * 100 + l * 10 + i, p * 100 + n * 10 + j,
# q * 100 + m * 10 + k))
print((o * 100 + l * 10 + i, p * 100 + n * 10 + j,
q * 100 + m * 10 + k))
温馨提示:答案为网友推荐,仅供参考