-
-
Save mcpower/d324cd0ecaa1294beb919542e0e30cc0 to your computer and use it in GitHub Desktop.
03
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dirs = dict(zip("UDLR", [-1j, 1j, -1+0j, 1+0j])) | |
SAMPLE = True | |
if SAMPLE: | |
inp = r"""5 10 25""" | |
else: | |
inp = r"""snipped""" | |
out = 0 | |
for line in inp.split("\n"): | |
a,b,c = map(int,line.split()) | |
if not (a+b <= c or b+c <= a or a+c <= b): | |
out += 1 | |
print(out) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dirs = dict(zip("UDLR", [-1j, 1j, -1+0j, 1+0j])) | |
SAMPLE = True | |
if SAMPLE: | |
inp = r"""101 301 501 | |
102 302 502 | |
103 303 503 | |
201 401 601 | |
202 402 602 | |
203 403 603""" | |
else: | |
inp = r"""snipped""" | |
out = 0 | |
x = [list(map(int, l.split())) for l in inp.split("\n")] | |
for x, y, z in zip(x[::3], x[1::3], x[2::3]): | |
for a, b, c in zip(x, y, z): | |
#a,b,c = map(int,line.split()) | |
if not (a+b <= c or b+c <= a or a+c <= b): | |
out += 1 | |
print(out) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment