#29680: python 測試沒問題,送出WA


Hell_DHGE (地獄HBBD a.k.a. Hell HBBD)

學校 : 國立成功大學
編號 : 181814
來源 : [140.116.132.135]
最後登入時間 :
2023-09-17 15:43:29

n = eval(input())

factorList = []

for i in range(1,n+1):

if n%i == 0:

factorList.append(i)

if sum(factorList) > 2*n:

print('盈數')

if sum(factorList) == 2*n:

print('完全數')

if sum(factorList) < 2*n:

print('虧數')

#29682: Re:python 測試沒問題,送出WA


cges30901 (cges30901)

學校 : 不指定學校
編號 : 30877
來源 : [39.12.66.21]
最後登入時間 :
2025-04-20 17:19:22

n = eval(input())

factorList = []

for i in range(1,n+1):

if n%i == 0:

factorList.append(i)

if sum(factorList) > 2*n:

print('盈數')

if sum(factorList) == 2*n:

print('完全數')

if sum(factorList) < 2*n:

print('虧數')


多筆輸入,直到EOF結束

另外建議eval改成int