Cod sursa(job #2493301)
Utilizator | Data | 16 noiembrie 2019 11:29:32 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.39 kb |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll modp=1999999973;
ll lgp(ll a,ll b){
if(b==0) return 1;
ll t=lgp(a,b/2);
if(b%2==1) return (((t*t)%modp)*a)%modp;
return (t*t)%modp;
}
ll n,m;
int main(){
ifstream fin;
fin.open("lgput.in");
ofstream fout;
fout.open("lgput.out");
fin>>n>>m;
fout<<lgp(n,m);
return 0;
}