FHVirus

68.6% (24/35)

48.1% (39/81)

# Description

#### Original Input Format

• $1 \le a,b,c \le 1000000000$

#### Original Sample Input

2 2 2


#### Original Sample Output

16


#### Original Limits

• Time Limit: 1 second
• Memory Limit: 256 MB

#### Program To Be Hacked

#include<iostream>
using namespace std;
long long mypow(long long A,long long B,long long M){ //calculate A^B % M
A%=M;
if(M==1) return 0;
if(B==0) return 1;
if(A==0) return 0;
long long mid=mypow(A,B/2,M);
if(B%2) return mid*mid%M*A%M;
else return mid*mid%M;
}
int main(){
long long a,b,c,p=880301;
cin>>a>>b>>c;
cout<<mypow(a,mypow(b,c,p-1),p)<<'\n';
}


#### Judge Method

long long mypow(long long A,long long B,long long M){ //calculate A^B % M
A%=M;
if(M==1) return 0;
if(B==0) return 1;
if(A==0) return 0;
long long mid=mypow(A,B/2,M);
if(B%2) return mid*mid%M*A%M;
else return mid*mid%M;
}


$a^ {b^ c} \equiv a^ {b^ c \bmod (p-1)} \pmod p$

#### Sample Code

#include <cstdio>
int main() {
printf("1 1 1\n");
}


# Problem Source

No. Testdata Range Score

# Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 65536 262144