Cod sursa(job #1687012)
Utilizator | Data | 12 aprilie 2016 16:55:02 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.38 kb |
#include <fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
long long n,m,p,i;
long long exp(long long a,long long b){
long long r=1;
while(b){
if (b&1){
r*=a;
r%=1999999973;
}
b>>=1;
a*=a;
a%=1999999973;
}
return r%1999999973;
}
int main(){
fin >>n>>p;
fout <<exp(n,p);
return 0;
}