Submission #3902

#TimeUsernameProblemLanguageResultExecution timeMemory
3902hyeonjae0310Great Pow! (kriii1_G)C++98
0 / 1
0 ms1852 KiB
#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 timeMemoryGrader output
Fetching results...