题解 | #完全数计算#
完全数计算
https://www.nowcoder.com/practice/7299c12e6abb437c87ad3e712383ff84
def perfect(num): list_ = [1] a = 0 for i in range(2, int(num**0.5)+1): if num % i == 0: list_.append(i) list_.append(num//i) for i in list_: a += i if a == num: return 1 else: return 0 nout = 0 for i in range(int(input())+1): nout += perfect(i) print(nout-1)