2017 progress.

This commit is contained in:
2024-05-18 07:38:03 -04:00
parent 3c290b8da3
commit 78b1981ddf
6 changed files with 146 additions and 1 deletions

18
2016/d19.py Normal file
View File

@@ -0,0 +1,18 @@
data = open(0).read().strip()
elf_count = int(data)
elfs = [i for i in range(1, elf_count + 1)]
while len(elfs) > 1:
is_odd = len(elfs) % 2 == 1
elfs = [elfs[i] for i in range(0, len(elfs), 2)]
if is_odd and len(elfs) > 1:
elfs = elfs[1:]
print(elfs[0])
# elfs = [i for i in range(1, elf_count + 1)]
# current_i = 0
# while len(elfs) > 1:
# remove_i = (current_i + len(elfs) // 2) % len(elfs)
# current_i = (current_i + 1) % len(elfs)
# elfs.pop(remove_i)
# print(elfs[0])