Cod sursa(job #317982)
Utilizator | Data | 26 mai 2009 12:36:37 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.25 kb |
#include<fstream.h>
#include<math.h>
int main()
{ifstream q("lgput.in");
ofstream w("lgput.out");
long long a,b;
q>>a>>b;
if(b%2==0)
while(b>1)
{b=b/2;
a=a*a;}
else
{b--;
while(b>1)
{b=b/2;
a=a*a;}
a=a*a;}
w<<a%1999999973;
return 0;}