Cod sursa(job #701519)
Utilizator | Data | 1 martie 2012 16:20:05 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.26 kb |
#include <fstream>
#include <iostream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int main()
{
int x,p,i=1;
fin>>x>>p;
while(p>1)
{
if(p%2==1)
{
p--;
i=i*p;
}
x=x*x;
p=p/2;
}
fout<<x%1999999973;
}