快速幂板子题
Code:
#include#include #include #include using namespace std;//Mystery_Sky//#define M 1000100#define ll long longll a, b, m;ll quickPow(ll x, ll k){ ll ret = 1; while(k) { if(k & 1) ret = (ret * x) % m; k >>= 1; x = (x * x) % m; } return ret;}int main() { scanf("%lld%lld%lld", &a, &b, &m); printf("%lld\n", quickPow(a, b)); return 0;}