n = int(input())
min_num = 10 ** (n-1)
max_num = 10 ** n
s = 0
count = n
for i in range(min_num,max_num):
temp = i
while count >= 1:
a = temp%10
temp = temp//10
s += a**n
count -= 1
if i == s:
print(i)
s = 0
count = n
浙大版《Python 程序设计》题目集 第4章-17 水仙花数(20 分) (20分)
最新推荐文章于 2026-04-21 02:39:16 发布
本文详细解析浙江大学《Python程序设计》课程第四章的一道练习题——水仙花数。水仙花数是指一个三位数,其各位数字立方和等于该数本身。文章将介绍水仙花数的概念,并提供Python代码实现来判断一个数是否为水仙花数。
525

被折叠的 条评论
为什么被折叠?



