본문 바로가기
python-algorithm

codeforces 1294A - Collecting Coins

by 무적김두칠 2022. 5. 12.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
t=int(input())
for i in range(t):
    nums=list(map(int,input().split()))
    n=nums[3]
 
    nums=nums[:3]
    threshold=max(nums)*3
    ans =n-(threshold-sum(nums))
    if ans<0print("NO")
    else :
        if ans%3 ==0 :
            print("YES")
        else:
            print("NO")
cs
반응형

댓글