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