标签:
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
#define mod 1003
int quick_power(int a, int b)
{
if(a == 0) return 0;
int ret = 1;
while(b)
{
if(b & 1)
ret = ret * a % mod;
a = a * a % mod;
b /= 2;
}
return ret;
}
int main()
{
int T;
scanf("%d", &T);
while(T--)
{
int m, n;
scanf("%d %d", &m, &n);
printf("%d\n", quick_power(m % mod, n));
}
}
标签:
原文地址:http://www.cnblogs.com/SSYYGAM/p/4214023.html