Compare commits
3 commits
5753f3bc44
...
6f0ffd34db
Author | SHA1 | Date | |
---|---|---|---|
Bruno BELANYI | 6f0ffd34db | ||
Bruno BELANYI | a064fe7199 | ||
Bruno BELANYI | 24610576bb |
20
2022/d01/ex1/ex1.py
Executable file
20
2022/d01/ex1/ex1.py
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
def solve(input: list[list[int]]) -> int:
|
||||
return max(map(sum, input), default=0)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
input = [
|
||||
[int(line) for line in group.splitlines()]
|
||||
for group in sys.stdin.read().split("\n\n")
|
||||
if group
|
||||
]
|
||||
print(solve(input))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
21
2022/d01/ex2/ex2.py
Executable file
21
2022/d01/ex2/ex2.py
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
def solve(input: list[list[int]]) -> int:
|
||||
totals = sorted(map(lambda l: sum(l, start=0), input), reverse=True)
|
||||
return sum(totals[:3])
|
||||
|
||||
|
||||
def main() -> None:
|
||||
input = [
|
||||
[int(line) for line in group.splitlines()]
|
||||
for group in sys.stdin.read().split("\n\n")
|
||||
if group
|
||||
]
|
||||
print(solve(input))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
2244
2022/d01/ex2/input
Normal file
2244
2022/d01/ex2/input
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue