Cod sursa(job #2336225)
Utilizator | Data | 4 februarie 2019 21:53:03 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.43 kb |
#include <fstream>
#include <iostream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
const int MOD = 1999999973;
int power(int x,int y){
int r=1;
while(y){
if(y%2 == 1)
r = (1LL*r*x)% MOD;
x=(1LL*x*x)% MOD;
y/=2;
}
return r;
}
int main()
{
int x, y;
cin>>x>>y;
int r=power(x,y);
cout<<r;
return 0;
}