Cod sursa(job #558147)
Utilizator | Data | 17 martie 2011 09:26:48 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.26 kb |
#include <fstream.h>
ifstream fin("expo.in");
ofstream fout("expo.out");
long long int n,px,rez,r,x;
int main()
{
fin>>x;
rez=1;
px=x;
fin>>n;
while(n>0)
{
r=n%2;
if(r==1)
rez=rez*px;
n=n/2;
px=px*px;
}
fout<<rez%1999999973;
}