본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 14563번 완전수

by 현장 2022. 6. 10.

-Code

n = int(input())
nums = list(map(int, input().split()))

for num in nums:
    total = 0
    for i in range(1, num):
        if num % i == 0:
            total += i
    if total == num:
        print("Perfect")
    elif total > num:
        print("Abundant")
    else:
        print("Deficient")