Cod sursa(job #1687008)
Utilizator | Data | 12 aprilie 2016 16:53:13 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.36 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%1999999973;
}
b>>=1;
a*=a%1999999973;
}
return r;
}
int main(){
fin >>n>>p;
fout <<exp(n,p);
return 0;
}