Cod sursa(job #1387628)
Utilizator | Data | 14 martie 2015 15:29:23 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.36 kb |
#include <fstream>
#define mod 1999999973
using namespace std;
ifstream f("lgput.in");
ofstream g("lgput.out");
int fct(long long baza,int e)
{
long long p=1;
while(e)
{
if(e&1)
p*=baza;
e>>=1;
baza=baza*baza%mod;
return p;
}
}
int main()
{
long long n,p;
f>>n>>p;
g<<fct(n,p)%mod;
return 0;
}