水仙花数是指一个 n 位数(n≥3 ),它的每个位上的数字的 n 次幂之和等于它本身(例如:1^3 + 5^3+ 3^3 = 153)
for i in range(100, 1000):
ge = (i // 1) % 10
shi = (i // 10) % 10
bai = (i // 100) % 10
if ge**3 + shi**3 + bai**3 == i:
print('{}是水仙花数'.format(i))
水仙花数是指一个 n 位数(n≥3 ),它的每个位上的数字的 n 次幂之和等于它本身(例如:1^3 + 5^3+ 3^3 = 153)
for i in range(100, 1000):
ge = (i // 1) % 10
shi = (i // 10) % 10
bai = (i // 100) % 10
if ge**3 + shi**3 + bai**3 == i:
print('{}是水仙花数'.format(i))