牛客练习赛43B

#include
using namespace std;
int main()
{
    int T;
    scanf("%d", &T);
    while(T--)
    {
        int m, n, k1, k2;
        scanf("%d%d%d%d", &m, &n, &k1, &k2);
        int a = 10, b = k1-1;
        long long ans = m;
        while(b)
        {
            if(b&1) ans = ans * a % n;
            a = (long long) a * a % n;
            b >>= 1;
        }
        cout<

 

你可能感兴趣的:(数论)