Cleaning.
This commit is contained in:
parent
7cb8317659
commit
4192c98bba
@ -14,7 +14,7 @@ for line in lines:
|
||||
values[-1] += int(line.strip())
|
||||
|
||||
# part 1
|
||||
print(f"max is {max(values)}")
|
||||
print(f"answer 1 is {max(values)}")
|
||||
|
||||
# part 2
|
||||
print(f"sum of top 3 is {sum(sorted(values)[-3:])}")
|
||||
print(f"answer 2 is {sum(sorted(values)[-3:])}")
|
||||
|
@ -12,7 +12,7 @@ def make_range(value: str) -> set[int]:
|
||||
|
||||
sections = [tuple(make_range(part) for part in line.split(",")) for line in lines]
|
||||
|
||||
score_1 = sum(s1.intersection(s2) in (s1, s2) for s1, s2 in sections)
|
||||
score_1 = sum(s1.issubset(s2) or s2.issubset(s1) for s1, s2 in sections)
|
||||
print(f"score 1 is {score_1}")
|
||||
|
||||
score_2 = sum(bool(s1.intersection(s2)) for s1, s2 in sections)
|
||||
|
@ -1,6 +1,5 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
|
||||
import itertools
|
||||
import sys
|
||||
|
||||
data = sys.stdin.read().strip()
|
||||
|
Loading…
Reference in New Issue
Block a user