标签:namespace lld algorithm int ring print stream cstring long
#include<iostream> #include<cstring> #include<cstdio> #include<string> #include<algorithm> #define LL long long using namespace std; LL PowerMod(LL a, LL b, LL c) { LL ans = 1; a = a%c; while(b) { if(b&1) ans = ans*a%c; b >>= 1; a = a*a%c; } return ans; } int main() { LL a,b,c; while(~scanf("%lld%lld%lld",&a,&b,&c)) { printf("%lld\n",PowerMod(a,b,c)); } return 0; } //XDOJ1026
标签:namespace lld algorithm int ring print stream cstring long
原文地址:http://www.cnblogs.com/zhurb/p/6021486.html