Skip to content

Commit 60c95a9

Browse files
committed
solved 615
1 parent 5a82882 commit 60c95a9

File tree

5 files changed

+167
-0
lines changed

5 files changed

+167
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"mainSolution": {
3+
"value": "/home/dipta007/my-world/gdrive/Programming/Contest-LIFE/@SITES/acmx/Codeforces - Codeforces Round #615 (Div. 3)/A. Collecting Coins/template.py"
4+
},
5+
"bruteSolution": {},
6+
"generator": {},
7+
"checker": {},
8+
"companionConfig": {
9+
"value": {
10+
"name": "A. Collecting Coins",
11+
"group": "Codeforces - Codeforces Round #615 (Div. 3)",
12+
"url": "https://codeforces.com/problemset/problem/1294/A",
13+
"memoryLimit": 256,
14+
"timeLimit": 2000
15+
}
16+
}
17+
}
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
""" Python 3 compatibility tools. """
2+
from __future__ import division, print_function
3+
import itertools
4+
import sys
5+
import os
6+
from io import BytesIO, IOBase
7+
8+
9+
if sys.version_info[0] < 3:
10+
input = raw_input
11+
range = xrange
12+
13+
filter = itertools.ifilter
14+
map = itertools.imap
15+
zip = itertools.izip
16+
17+
18+
def is_it_local():
19+
script_dir = str(os.getcwd()).split('/')
20+
username = "dipta007"
21+
return username in script_dir
22+
23+
24+
def READ(fileName):
25+
if is_it_local():
26+
sys.stdin = open(f'./{fileName}', 'r')
27+
28+
# region fastio
29+
BUFSIZE = 8192
30+
31+
class FastIO(IOBase):
32+
newlines = 0
33+
34+
def __init__(self, file):
35+
self._fd = file.fileno()
36+
self.buffer = BytesIO()
37+
self.writable = "x" in file.mode or "r" not in file.mode
38+
self.write = self.buffer.write if self.writable else None
39+
40+
def read(self):
41+
while True:
42+
b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
43+
if not b:
44+
break
45+
ptr = self.buffer.tell()
46+
self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
47+
self.newlines = 0
48+
return self.buffer.read()
49+
50+
def readline(self):
51+
while self.newlines == 0:
52+
b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
53+
self.newlines = b.count(b"\n") + (not b)
54+
ptr = self.buffer.tell()
55+
self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
56+
self.newlines -= 1
57+
return self.buffer.readline()
58+
59+
def flush(self):
60+
if self.writable:
61+
os.write(self._fd, self.buffer.getvalue())
62+
self.buffer.truncate(0), self.buffer.seek(0)
63+
64+
65+
class IOWrapper(IOBase):
66+
def __init__(self, file):
67+
self.buffer = FastIO(file)
68+
self.flush = self.buffer.flush
69+
self.writable = self.buffer.writable
70+
self.write = lambda s: self.buffer.write(s.encode("ascii"))
71+
self.read = lambda: self.buffer.read().decode("ascii")
72+
self.readline = lambda: self.buffer.readline().decode("ascii")
73+
74+
if not is_it_local():
75+
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
76+
input = lambda: sys.stdin.readline().rstrip("\r\n")
77+
78+
# endregion
79+
80+
81+
def input1(type=int):
82+
return type(input())
83+
84+
85+
def input2(type=int):
86+
[a, b] = list(map(type, input().split()))
87+
return a, b
88+
89+
90+
def input3(type=int):
91+
[a, b, c] = list(map(type, input().split()))
92+
return a, b, c
93+
94+
95+
def input_array(type=int):
96+
return list(map(type, input().split()))
97+
98+
99+
def input_string():
100+
s = input()
101+
return list(s)
102+
103+
if is_it_local():
104+
def debug(*args):
105+
st = ""
106+
for arg in args:
107+
st += f"{arg} "
108+
print(st)
109+
else:
110+
def debug(*args):
111+
pass
112+
113+
##############################################################
114+
115+
def main():
116+
t = input1()
117+
for ci in range(t):
118+
[a, b, c, n] = input_array()
119+
120+
mx = max(a, b, c)
121+
122+
n -= (mx - a)
123+
n -= (mx - b)
124+
n -= (mx - c)
125+
126+
if n >= 0 and n%3 == 0:
127+
print('YES')
128+
else:
129+
print('NO')
130+
pass
131+
132+
if __name__ == '__main__':
133+
# READ('in.txt')
134+
main()
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
YES
2+
YES
3+
NO
4+
NO
5+
YES
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
5
2+
5 3 2 8
3+
100 101 102 105
4+
3 2 1 100000000
5+
10 20 15 14
6+
101 101 101 3
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
YES
2+
YES
3+
NO
4+
NO
5+
YES

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy