count = int(input())
is_perfect = 0
for i in range(count):
for j in range(i/2+1):
if i/j == 0:
is_perfect += j
if is_perfect == i:
print('%d ' % is_perfect)
is_perfect = 0
上面那条回复更新了一下,你的代码还有其他问题,,,,,,
count = int(input())
is_perfect = 0
for i in range(count):
for j in range(1,int(i/2)+1):
if i%j == 0:
is_perfect += j
if is_perfect == i:
print('%d ' % is_perfect)
is_perfect = 0
我改成了这样 好像还是有问题