[알고리즘/백준] 19539번 : 사과나무(python)

유현민·2022년 3월 15일
0

알고리즘

목록 보기
54/253

배수를 이용하여 풀면되는 문제이다.
다 더한게 3의 배수이면서 //2 > //3 이면 'YES'


N = int(input())
a = list(map(int, input().split()))
tmp = 0
flag = True
if sum(a) % 3 == 0:
    for i in range(N):
        tmp += a[i] // 2
    if tmp < sum(a) // 3:
        flag = False
else:
    flag = False
print('YES') if flag else print('NO')
profile
smilegate megaport infra

0개의 댓글