#include <iostream> using namespace std; int main() { long long a, b, p; cin >> a >> b >> p; long long res = 1 % p; //此处若不mod p,则测试用例为 123456789 0 1 时,会输出1,但应该输出0 while(b) { if(b & 1) res = res * a % p; a = a * a % p; b >>= 1; } cout << res << endl; return 0; }