题解 | #完全数计算#
完全数计算
https://www.nowcoder.com/practice/7299c12e6abb437c87ad3e712383ff84
def isperfect(num): lst = [1] if num == 1 or num == 2: return False for i in range(2,(num//2)+1): if num % i == 0: lst.append(i) if num == sum(lst): return True return False while True: try: N = int(input()) count = 0 for i in range(1,N+1): if isperfect(i): count += 1 print(count) except: break