Submission #4338

# Submission time Handle Problem Language Result Execution time Memory
4338 2013-09-17T08:31:28 Z zorrapower Great Pow! (kriii1_G) C++
0 / 1
10000 ms 1088 KB
#include<stdio.h>

long long pow(long long a, long long n);
int main(void){
	long long a, k;
	long long result;

	scanf("%lld %lld",&a, &k);
	result=a;

	for(int i=0; i<k; i++){
		result=pow(a, result)%(a+1);
	}
	printf("%d", result);
	while(true);
	return 0;
}

long long pow(long long a, long long n){
	long long result=1;
	for(int i=0; i<n; i++)
		result*=a;
	return result;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 10000 ms 1088 KB Program timed out
2 Halted 0 ms 0 KB -