[Python/2016] Move solutions into .py files
This commit is contained in:
parent
0269ad8fc3
commit
2514b1d11f
50 changed files with 1172 additions and 3386 deletions
17
Python/2016/19.py
Normal file
17
Python/2016/19.py
Normal 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)
|
Loading…
Add table
Add a link
Reference in a new issue