Cod sursa(job #873494)
Utilizator | Data | 7 februarie 2013 12:04:25 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.26 kb |
#include<fstream>
using namespace std;
ifstream f("lgput.in");
ofstream g("lgput.out");
long long n,p,k;
int main()
{
f>>n>>p;
k=1;
while(p!=0)
{
k=(k*n)%1999999973;
n=n*n%1999999973;
p=p/2;
}
g<<k;
}