Cod sursa(job #1318934)
Utilizator | Data | 16 ianuarie 2015 15:01:05 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.32 kb |
#include<fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int main()
{
long long N,P,M,x,y,i;
fin>>N>>P;
M=1999999973;
x=N%M;
y=1;
for(i=1;i<=P;i++)
{
y=(y*x)%M;
}
fout<<y<<"\n";
fin.close();
fout.close();
return 0;
}