2021: d01: ex1: add solution
This commit is contained in:
parent
66d3a850c0
commit
81e3d484c8
18
2021/d01/ex1/ex1.py
Executable file
18
2021/d01/ex1/ex1.py
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import itertools
|
||||
import sys
|
||||
from typing import List
|
||||
|
||||
|
||||
def solve(input: List[int]) -> int:
|
||||
return sum(prev < cur for (prev, cur) in itertools.pairwise(input))
|
||||
|
||||
|
||||
def main() -> None:
|
||||
input = [int(line) for line in sys.stdin.readlines()]
|
||||
print(solve(input))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
Reference in a new issue