From 2d4c51a7ce7d340dbf1d0fb22393b687b4a3b844 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sun, 8 Dec 2019 18:04:03 +0100 Subject: [PATCH] 2019: d01: ex1: add solution --- 2019/d01/ex1/ex1.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 2019/d01/ex1/ex1.py diff --git a/2019/d01/ex1/ex1.py b/2019/d01/ex1/ex1.py new file mode 100755 index 0000000..9cc31eb --- /dev/null +++ b/2019/d01/ex1/ex1.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python +import sys +from typing import List + + +def solve(nums: List[int]) -> int: + return sum(num // 3 - 2 for num in nums) + + +def main() -> None: + print(solve(list(int(lines) for lines in sys.stdin))) + + +if __name__ == "__main__": + main()