Pagini recente » Cod sursa (job #754529) | Cod sursa (job #2066124) | Cod sursa (job #2815754) | Cod sursa (job #1899089) | Cod sursa (job #1723547)
#include <stdlib.h>
#include <stdio.h>
#define big 1999999973
long long int expo(int a, int n)
{
if (n == 0)
{
return 1;
}
else if (n == 1)
{
return a;
}
else if (n % 2 == 0)
{
return expo(a, n/2)*expo(a,n/2)% big;
}
else
{
return a*expo(a, n / 2)*expo(a, n / 2)%big;
}
}
int main()
{
int a, n;
FILE *A = fopen("lgput.in", "r");
FILE *B = fopen("lgput.out", "w");
fscanf(A, "%d %d", &a, &n);
fprintf(B,"%ld",expo(a, n));
}