Cod sursa(job #2846107)
Utilizator | nick gurr Schweppes | Data | 8 februarie 2022 19:27:22 |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.45 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
const int MOD=1999999973;
unsigned long long expo(unsigned long long a, unsigned long long b){
unsigned long long rez=1;
while(b){
if(b&1)rez=(rez*a)%MOD;
a=(a*a)%MOD;
b/=2;
}
return rez;
}
int main(){
unsigned long long a,b;
fin >> a >>b;
fout<<expo(a,b);
return 0;
}