Cod sursa(job #2183355)
Utilizator | Data | 23 martie 2018 08:54:16 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.36 kb |
#include <bits/stdc++.h>
#define ll long long
#define mod 1999999973
using namespace std;
ifstream in("lgput.in");
ofstream out("lgput.out");
ll x, y;
ll lg(ll a, ll p){
ll rs = 1;
while(p){
if(p & 1)
rs = (rs * a) % mod;
a = (a * a) % mod;
p >>= 1;
}
return rs;
}
int main(){
in >> x >> y;
out << lg(x, y);
return 0;
}