Pagini recente » Monitorul de evaluare | Cod sursa (job #1827424) | Cod sursa (job #310149) | Istoria paginii utilizator/mihnea_dumitru | Cod sursa (job #164566)
Cod sursa(job #164566)
#include <stdio.h>
#define mod 1999999973
int a, b;
int Putere(int a, int b);
int main()
{
freopen("lgput.in", "r", stdin);
freopen("lgput.out", "w", stdout);
scanf("%d %d", &a, &b);
printf("%d\n", Putere(a, b));
return 0;
}
int Putere(int a, int b)
{
if ( b == 1 ) return a%mod;
if ( b == 0 ) return 1;
if ( b % 2 == 0 )
{
long long int c = 1;
c = Putere(a, b/2);
c = (c*c)%mod;
return c;
}
else
{
long long int c = 1;
c = Putere(a, b/2);
c = (c*c)%mod;
c = (c*a)%mod;
return c;
}
}