Cod sursa(job #2814855)
Utilizator | Seracovanu Edward SeracovanuEdward | Data | 8 decembrie 2021 18:18:03 |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.42 kb |
#include <iostream>
#define ll long long int
using namespace std;
const ll mod=1999999973;
ll a,b;
inline ll expo(ll a,ll b){
ll rez=1;
while(b){
if(b&1)
rez=rez*a%mod;
a=a*a%mod;
b>>=1;
}
return rez;
}
int main()
{
freopen("lgput.in","r",stdin);
freopen("lgput.out","w",stdout);
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cin>>a>>b;
cout<<expo(a,b);
}