Compare commits
No commits in common. "ab7ad7c09e401fe79a076ea342b1067fd8e88066" and "fe1a61e3695d9e50038aa794b46837531caa1617" have entirely different histories.
ab7ad7c09e
...
fe1a61e369
@ -1,29 +0,0 @@
|
||||
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
|
@ -1,25 +0,0 @@
|
||||
import io
|
||||
import sys
|
||||
|
||||
sys.stdin = io.StringIO('''4
|
||||
100 98
|
||||
42 32
|
||||
1000000000000000000 1
|
||||
41 40''')
|
||||
|
||||
|
||||
# 数论基础 唯一分解定理(算术基本定理)
|
||||
# x - n*p = y
|
||||
# 则 n*p = x - y = z
|
||||
# 大于1的整数就满足 可分解为任意素数乘积
|
||||
def fun(x, y):
|
||||
z = x - y
|
||||
return z > 1
|
||||
|
||||
|
||||
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