只有24分
查看原帖
只有24分
1592128
Coke666zzx楼主2024/12/17 14:50
#include <bits/stdc++.h>
using namespace std;
int quickpower(int a,int b)
{
    int ans = 1,base = a;
    while(b>0)
    {
        if(b&1)
        {
            ans *= base;
        }
        base*=base;
        b>>=1;
    }
    return ans;
}
int main()
{
    unsigned long long a,b,p;
    cin>>a>>b>>p;
    printf("%lu^%lu mod %lu=%lu",a,b,p,quickpower(a,b)%p);
    return 0;
}
2024/12/17 14:50
加载中...