Cod sursa(job #1899841)
Utilizator | Data | 2 martie 2017 22:48:12 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.36 kb |
#include<fstream>
using namespace std;
ifstream f ("lgput.in");
ofstream g ("lgput.out");
long long expo(int x,int y){
if(y==0) return 1;
long long aux=expo(x,y/2)%1999999973
;
if(y%2==1){
return x*aux*aux%1999999973;
}
return aux*aux%1999999973;
}
int main()
{
int a,b;
f>>a>>b;
g<<expo(a,b)%1999999973;
}