init
This commit is contained in:
commit
851751ea87
82 changed files with 2093 additions and 0 deletions
22
9F.py
Normal file
22
9F.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import sys
|
||||
|
||||
sys.set_int_max_str_digits(300000)
|
||||
|
||||
input_data = sys.stdin.read().split()
|
||||
x = int(input_data[0])
|
||||
k = int(input_data[1])
|
||||
|
||||
if x == 0:
|
||||
print(0)
|
||||
elif x == 1:
|
||||
print(1)
|
||||
else:
|
||||
y = 1 << ((x.bit_length() + k - 1) // k)
|
||||
|
||||
while True:
|
||||
next_y = ((k - 1) * y + x // (y ** (k - 1))) // k
|
||||
if next_y >= y:
|
||||
break
|
||||
y = next_y
|
||||
|
||||
print(y)
|
||||
Loading…
Add table
Add a link
Reference in a new issue