Cod sursa(job #1116759)
Utilizator | Data | 22 februarie 2014 19:54:59 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.28 kb |
#include<fstream>
#define dmax 1999999973
using namespace std;
unsigned long long n,p,x,i;
int main()
{
ifstream fin("lgput.in");
ofstream fout("lgput.out");
fin>>n>>p;x=n;
for(i=2;i<=p;++i)
{
x=(x*n)%dmax;
}
fout<<x%dmax;
return 0;
}