From 7d65b8c204f3035cdec97d7ace5000854eb53ad3 Mon Sep 17 00:00:00 2001 From: licsber Date: Sat, 8 Jul 2023 13:02:23 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E7=AE=80=E5=8D=95=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E7=AD=BE=E5=88=B0=E9=A2=98.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- luogu/njit-baidu2023/ta.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 luogu/njit-baidu2023/ta.py diff --git a/luogu/njit-baidu2023/ta.py b/luogu/njit-baidu2023/ta.py new file mode 100644 index 0000000..4ff62e2 --- /dev/null +++ b/luogu/njit-baidu2023/ta.py @@ -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