题解 | #完全数计算#好像有点慢
完全数计算
http://www.nowcoder.com/practice/7299c12e6abb437c87ad3e712383ff84
while True:
try:
n = int(input())
count = 0
for i in range(1, n + 1):
yinZi_sum = 0
for j in range(1, i):
if i % j == 0:
yinZi_sum += j
if yinZi_sum == i:
count += 1
print(count)
except:
break
try:
n = int(input())
count = 0
for i in range(1, n + 1):
yinZi_sum = 0
for j in range(1, i):
if i % j == 0:
yinZi_sum += j
if yinZi_sum == i:
count += 1
print(count)
except:
break