Efficiency in Perfect number code (Python)

后端 未结 0 1400
遥遥无期
遥遥无期 2021-01-31 14:16
n = int(input())
sum1 = 0
for i in range(1, n//2  + 1):
    if(n % i == 0):
        sum1 = sum1 + i
if (sum1 == n):
    print("YES")
else:
    print("NO&q         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题