Mai intai trebuie sa te autentifici.
Cod sursa(job #1133914)
Utilizator | Data | 5 martie 2014 19:58:46 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.57 kb |
#include<iostream>
#include<fstream>
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=p*x;
p%=1999999973;
}
x=x*x;
y>>=1;
}
fout<<p%1999999973<<"\n";
}
int main()
{
Citire();
Rezolva();
//fout<<n<<" "<<p;
return 0;
}