# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
3902 | hyeonjae0310 | Great Pow! (kriii1_G) | C++98 | 0 ms | 1852 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <cmath>
using namespace std;
long long mm;
long long calc(long long a, long long k)
{
a=a%mm;
if(k==1) return pow(a,a);
return calc(pow(a,a),k-1);
}
int main()
{
long long a,k;
cin>>a>>k;
mm=a+1;
cout<<calc(a,k)%mm;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |