落谷p1226
理论依据
#include<iostream> #include<cstdio> using namespace std; long long fun(long long a,long long b,long long c){ long long An = 1; long long T = a % c; while(b!=0){ if(b&1){ An = (An * T)%c; } b >>= 1; T = (T*T)%c; } return An; } int main(){ long long a,b,c; cin >> a >> b >> c; // cout << fun(a,b,c); printf("%lld^%lld mod %lld=%lld",a,b,c,fun(a,b,c)); }