Cod sursa(job #2773138)
Utilizator | Data | 4 septembrie 2021 22:49:15 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.36 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("lgput.in");
ofstream fout ("lgput.out");
const long long MOD = 1999999973;
long long a, b, sol=1;
int main (){
fin>>a>>b;
while(b){
if(b%2 == 1)
sol = 1LL * sol * a % MOD;
b/=2;
a = 1LL * a * a % MOD;
}
fout<<sol;
return 0;
}