From 41a7054551eda1688679c4c377ad320f48c74590 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sat, 10 May 2025 13:46:17 +0100 Subject: [PATCH] 2017: d17: ex1: add solution --- 2017/d17/ex1/ex1.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 2017/d17/ex1/ex1.py diff --git a/2017/d17/ex1/ex1.py b/2017/d17/ex1/ex1.py new file mode 100755 index 0000000..ad650a7 --- /dev/null +++ b/2017/d17/ex1/ex1.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +import collections +import sys + + +def solve(input: str) -> int: + def parse(input: str) -> int: + return int(input.strip()) + + lock = collections.deque([0]) + step = parse(input) + for i in range(1, 2017 + 1): + lock.rotate(-step) + lock.append(i) + return lock[0] + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main()