返回列表 發帖
def compute(n):
    total=0
    for j in range(1,n):
        s=0
        str1=str(j)
        for i in range(0,len(str1)):
            s=s+math.pow(int(str1[i]),len(str1))
        
        if(int(s)==int(str1)):
            print(f"{str1}")
            total=total+j
    return total
import math
n=int(input())
t=compute(n)
print(t)

TOP

返回列表