Cod sursa(job #567583)
Utilizator | Data | 30 martie 2011 10:44:58 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.31 kb |
#include<fstream.h>
ifstream f("lgput.in");
ofstream g("lgput.out");
long long y,z,x;
int c=1999999973;
int mod( int a, int b)
{
if(b==0)
{
return 1;
}
else
{
x=mod(a,b/2);
if(b%2==0)
return x*x%c;
else
return x*x%c*a%c;
}
}
int main()
{
f>>y>>z;
g<<mod(y,z)%c;
}