Pagini recente » Cod sursa (job #2425661) | Cod sursa (job #1377951) | Cod sursa (job #1291742) | Rating Butacu Gheorghe Claudiu (claudiubutacu) | Cod sursa (job #1831104)
#include<stdio.h>
#define MOD 1999999973
long long expo(long long a, long long b){
if (b==1)
return a%MOD;
if (b==2)
return (a%MOD * a%MOD)%MOD;
if (b%2==0){
return expo(expo(a, b/2), 2);
}
else{
return a * expo(expo(a, (b-1)/2), 2);
}
}
//-----------------------
int main() {
FILE *file1, *file2;
long long N, P;
file1 = fopen("lgput.in", "r");
file2 = fopen("lgput.out", "w");
fscanf(file1, "%lld", &N);
fscanf(file1, "%lld", &P);
N %= MOD;
fprintf(file2, "%lld", expo(N, P));
return 0;
}