题解 | #完全数计算#
完全数计算
https://www.nowcoder.com/practice/7299c12e6abb437c87ad3e712383ff84
n = int(input())
index = 0
ss =[]
for i in range(1,n+1):
ss = []
total = 0
for j in range(1,i,1):
if i % j == 0:
ss.append(j)
for k in ss:
total += k
if total == i:
index += 1
print(index)
联想公司福利 1500人发布
查看9道真题和解析