题解 | #完全数计算#
完全数计算
https://www.nowcoder.com/practice/7299c12e6abb437c87ad3e712383ff84
n = int(input()) c = 0 for i in range(1,n+1): sum = 0 for j in range(1,i//2+1): if i%j == 0: sum += j if sum == i: c += 1 print(c)
完全数计算
https://www.nowcoder.com/practice/7299c12e6abb437c87ad3e712383ff84
n = int(input()) c = 0 for i in range(1,n+1): sum = 0 for j in range(1,i//2+1): if i%j == 0: sum += j if sum == i: c += 1 print(c)
相关推荐