2017 progress.
This commit is contained in:
18
2016/d19.py
Normal file
18
2016/d19.py
Normal 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])
|
||||
Reference in New Issue
Block a user