#32459: python解法參考


tanuki102 (tanuki)

學校 : 國立桃園高級中學
編號 : 140025
來源 : [122.116.178.82]
最後登入時間 :
2022-10-13 22:52:35
a040. 阿姆斯壯數 | From: [122.116.178.82] | 發表日期 : 2022-10-12 22:54

import math
number = input()
divi_number = number.split(' ')
count = 0
for i in range(int(divi_number[0]), int(divi_number[1])):
    times = int(math.log10(i)) + 1
    total = 0
    str_i = str(i)
    for j in range(times):
        total += int(str_i[j])**times
    if i == total:
        print(i, end=" ")
        count += 1

if count == 0:
    print("none")
 
ZeroJudge Forum