标签:
[2016-03-05][UVALive][4104][MODEX]#include <vector> #include <list> #include <map> #include <set> #include <deque> #include <queue> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <cctype> #include <string> #include <cstring> #include <cstdio> #include <cmath> #include <cstdlib> #include <ctime> using namespace std; typedef long long LL; #define CLR(x,y) memset((x),(y),sizeof((x))) #define FOR(x,y,z) for(int (x)=(y);(x)<(z);++(x)) #define FORD(x,y,z) for(int (x)=(y);(x)>=(z);--(x)) #define FOR2(x,y,z) for((x)=(y);(x)<(z);++(x)) #define FORD2(x,y,z) for((x)=(y);(x)>=(z);--(x)) long long pow_mod(long long a ,long long p ,long long mod ){ long long res = 1; while ( p > 0){ if ( p & 1) res = (res * a)% mod; p >>= 1; a = ( a * a) % mod; } return res; } int main(){ int c; scanf("%d",&c); while(c--){ int x,y,n; scanf("%d%d%d",&x,&y,&n); LL res = pow_mod(x,y,n); printf("%lld\n",res); } return 0; } |
[2016-03-05][UVALive][4104][MODEX]
标签:
原文地址:http://www.cnblogs.com/qhy285571052/p/5245941.html