题解 | #完全数计算#
完全数计算
https://www.nowcoder.com/practice/7299c12e6abb437c87ad3e712383ff84
''' l=[0,1,2,3,6] print(sum(l[:-1])==l[4]) 100 1 2 4 5 10 100 50 25 20 10 ''' n=int(input()) cnt=0 for each in range(1,n+1): factor=[] for i in range(1,int(each**0.5)+1): if each%i == 0: factor.append(i) factor.append(int(each/i)) factor.sort() #print(factor) if sum(factor[:-1])==factor[-1] and len(factor)>2: cnt += 1 #print(factor[-1]) print(cnt)