[Python/2016] Move solutions into .py files

This commit is contained in:
Felix Bargfeldt 2023-10-29 12:38:12 +01:00
parent 0269ad8fc3
commit 2514b1d11f
Signed by: Defelo
GPG key ID: 2A05272471204DD3
50 changed files with 1172 additions and 3386 deletions

17
Python/2016/19.py Normal file
View file

@ -0,0 +1,17 @@
from lib import *
input = read_input(2016, 19)
n = int(input)
print((n - (1 << n.bit_length() - 1) << 1) + 1)
n = int(input)
l = int(math.log(n, 3))
x = 3**l + 1
y = 2 * 3**l
z = 3 ** (l + 1)
if n <= y:
print(n - x + 1)
else:
print(n * 2 - y - x + 1)