题解 | #完全数计算#
完全数计算
https://www.nowcoder.com/practice/7299c12e6abb437c87ad3e712383ff84
n = int(input()) def func(n): # 实现因子函数 nums = [] for i in range(1,n): if n % i == 0: nums.append(i) return sum(nums) counter = 0 for i in range(1,n + 1): # 遍历1到n if func(i) == i: counter += 1 print(counter)