Cod sursa(job #1623871)
| Utilizator | Data | 1 martie 2016 22:26:34 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.47 kb |
#include <bits/stdc++.h>
using namespace std;
#ifdef INFOARENA
#define cout fout
#endif // INFOARENA
ifstream fin("lgput.in");
ofstream fout("lgput.out");
/// ////////////////////////
#define mod 1999999973
#define lint long long
lint power(lint n,lint p)
{
lint res=1;
for(;p;p>>=1)
{
if(p&1) res=res*n%mod;
n=n*n%mod;
}
return res;
}
int main()
{
lint n,p;
fin>>n>>p;
cout<<power(n,p);
return 0;
}
