Cod sursa(job #1535451)
Utilizator | Data | 24 noiembrie 2015 19:36:55 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.37 kb |
#include <iostream>
#define mod 1999999973
using namespace std;
long long putere(long long base,long long exponent){
if(exponent==0)
return 1;
if(exponent%2)
return base*putere(base*base,exponent/2)%mod;
return putere(base*base,exponent/2)%mod;
}
int main()
{
long long a,b;
cin>>a>>b, cout<<putere(a,b);
return 0;
}