2017: d17: ex1: add solution
This commit is contained in:
parent
3c2fdb87d9
commit
41a7054551
1 changed files with 25 additions and 0 deletions
25
2017/d17/ex1/ex1.py
Executable file
25
2017/d17/ex1/ex1.py
Executable file
|
|
@ -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()
|
||||
Loading…
Add table
Add a link
Reference in a new issue