Cod sursa(job #3245345)
Utilizator | Data | 28 septembrie 2024 16:35:26 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.39 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int MOD=1999999973;
int fast_exp(long long a,int b){
long long ans=1;
while(b){
if(b%2){
ans=(ans*a)%MOD;
}
a=(a*a)%MOD;
b/=2;
}
return ans;
}
int main(){
long long a,b;
fin>>a>>b;
fout<<fast_exp(a,b);
}