完美立方

1 import math
2 inputNum = input("")
3 num=int(inputNum)+1
4 for a in range(2,num):
5     for b in range(2,a):
6         for c in range(b,a):
7             for d in range(c,a):
8                 if math.pow(a,3) ==math.pow(b,3)+math.pow(c,3)+math.pow(d,3):
9                     print ("Cute = %d,Triple = (%d,%d,%d)"%(a,b,c,d))

posted @ 2020-09-29 00:12  17wzl  阅读(114)  评论(0)    收藏  举报