题解 | #水仙花数#

水仙花数

https://www.nowcoder.com/practice/dc943274e8254a9eb074298fb2084703

while 1:
    try:
        list = []
        m,n = map(int,input().split())       
        for i in range(m,n+1):
            sum = 0           
            for j in str(i):
                sum += int(j)**3
            if sum == i:
                list.append(str(i))
        if not list:
            print('no')
        else:
            print(' '.join(list))
    except:
        break

#题解#
全部评论

相关推荐

点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务