Submission #3899

# Submission time Handle Problem Language Result Execution time Memory
3899 2013-08-31T09:13:11 Z hyeonjae0310 Great Pow! (kriii1_G) C++
0 / 1
0 ms 1852 KB
#include <iostream>
#include <cmath>

using namespace std;

long long calc(long long a, long long k)
{
	a=a%1000000000;
	if(k==1) return pow(a,a);
	return calc(pow(a,a),k-1);
}

int main()
{
	long long a,k;
	cin>>a>>k;
	cout<<calc(a,k)%a+1;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1852 KB Output isn't correct
2 Halted 0 ms 0 KB -