#30879: python 暴力新手硬解


f950202@apps.ntpc.edu.tw (王恆佑)

學校 : 新北市立鶯歌高級工商職業學校
編號 : 192783
來源 : [36.226.159.116]
最後登入時間 :
2024-05-09 23:23:26
a040. 阿姆斯壯數 | From: [1.171.254.227] | 發表日期 : 2022-06-18 23:17

a=input().split() if int(a[0])0 and int(a[1])<1000000: for i in range(int(a[0]),int(a[1])): b=len(str(i)) if b==1: print(i,end=" ") if b==3 and int(max(a))>=153: n=str(i) s=(int(n[0])**b+int(n[1])**b+int(n[2])**b) if i==s: print(i,end=" ") if b==4: n=str(i) s=(int(n[0])**b+int(n[1])**b+int(n[2])**b+int(n[3])**b) if i==s: print(i,end=" ") if b==5: n=str(i) s=(int(n[0])**b+int(n[1])**b+int(n[2])**b+int(n[3])**b+int(n[4])**b) if i==s: print(i,end=" ") if b==6: n=str(i) s=(int(n[0])**b+int(n[1])**b+int(n[2])**b+int(n[3])**b+int(n[4])**b+int(n[5])**b) if i==s: print(i,end=" ") if b==2: print("none") if i>=100 and i<=152: print("none") if i>=1000 and i<=1633: print("none") if i>=10000 and i<=54747: print("none") if i>=100000 and i<=548833: print("none")

 
ZeroJudge Forum