#include <stdio.h>
long long pow_mod(long long n, long long p, long long m)
{
long long t;
if ( p == 0 ) {
return 1;
} else if ( p % 2 == 1 ) {
return pow_mod(n, p-1, m) * n % m;
} else {
t = pow_mod(n, p/2, m);
return t * t % m;
}
}
int main(void)
{
long long ans;
long long n, m, p;
scanf("%ld %ld %ld", &n, &m, &p);
ans = pow_mod(n, p, m);
printf("%ld\n", ans);
return 0;
}
./Main.c: In function ‘main’:
./Main.c:20:9: warning: format ‘%ld’ expects argument of type ‘long int *’, but argument 2 has type ‘long long int *’ [-Wformat=]
scanf("%ld %ld %ld", &n, &m, &p);
^
./Main.c:20:9: warning: format ‘%ld’ expects argument of type ‘long int *’, but argument 3 has type ‘long long int *’ [-Wformat=]
./Main.c:20:9: warning: format ‘%ld’ expects argument of type ‘long int *’, but argument 4 has type ‘long long int *’ [-Wformat=]
./Main.c:23:10: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘long long int’ [-Wformat=]
printf("%ld\n", ans);
^
./Main.c:20:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%ld %ld %ld", &n, &m, &p);
^