Cod sursa(job #1643690)
Utilizator | Data | 9 martie 2016 19:49:30 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.31 kb |
#include <fstream>
#define mod 1999999973
using namespace std;
ifstream f("lgput.in");
ofstream g("lgput.out");
long long n,x,a;
int main()
{
f>>x>>n;
a=1;
while(n)
{
if(n%2==1) a=(a*x)%mod;
x=(x*x)%mod;
n=n/2;
}
g<<a%mod;
return 0;
}