Cod sursa(job #1133923)
| Utilizator | Data | 5 martie 2014 20:05:18 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.57 kb |
#include<iostream>
#include<fstream>
#define mod 1999999973
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
long long x,y,p;
inline void Citire()
{
fin>>x>>y;
}
inline void Rezolva()
{
p=1;
while (y!=0)
{
if (y%2==1)
{
y--;
p=(1LL*p*x)%m;
}
x=(1LL*x*x)%m;
y>>=1;
}
p=p%m;
fout<<p<<"\n";
}
int main()
{
Citire();
Rezolva();
//fout<<n<<" "<<p;
return 0;
}
