Cod sursa(job #2370529)
| Utilizator | Data | 6 martie 2019 12:32:18 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.41 kb |
#include <stdio.h>
#define mod 1999999973
using namespace std;
long long a,b;
long long putere(long long a,long long b){
if(b==0) return 1;
long long x=putere(a,b/2);
if(b%2==1) return x*x%mod*a%mod;
else return x*x%mod;
}
int main()
{
freopen("lgput.in","r",stdin);
freopen("lgput.out","w",stdout);
scanf("%lld%lld",&a,&b);
printf("%lld\n",putere(a,b));
return 0;
}
