add 简单判断签到题.
This commit is contained in:
parent
fe1a61e369
commit
7d65b8c204
29
luogu/njit-baidu2023/ta.py
Normal file
29
luogu/njit-baidu2023/ta.py
Normal file
@ -0,0 +1,29 @@
|
||||
import io
|
||||
import sys
|
||||
|
||||
sys.stdin = io.StringIO('''5
|
||||
5 3 2 8
|
||||
100 101 102 105
|
||||
3 2 1 100000000
|
||||
10 20 15 14
|
||||
101 101 101 3''')
|
||||
|
||||
|
||||
def fun(a, b, c, n):
|
||||
total = a + b + c + n
|
||||
if total % 3 != 0:
|
||||
return False
|
||||
|
||||
avg = total // 3
|
||||
if avg - a < 0 or avg - b < 0 or avg - c < 0:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
t = int(input())
|
||||
for _ in range(t):
|
||||
print('YES' if fun(*map(int, input().split())) else 'NO')
|
||||
|
||||
if __name__ == '__main__':
|
||||
pass
|
Loading…
Reference in New Issue
Block a user