Cod sursa(job #2449038)
Utilizator | Data | 17 august 2019 22:47:24 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | py | Status | done |
Runda | Arhiva educationala | Marime | 0.3 kb |
#!/usr/bin/env python3
import sys
sys.stdout = open('lgput.out', 'w')
MOD = 1999999973
def pow(x, p):
r = 1
while p:
if p % 2: r = (r * x) % MOD
p //= 2
x = (x * x) % MOD
return r
with open('lgput.in', 'r') as fin:
print(pow(*map(int, fin.readline().split())))