15 条题解

  • 1
    @ 2026-4-19 15:30:45

    老师眼中的魔术

    #include<bits/stdc++.h>
    using namespace std;
        int a,b,p;
        int quick_pow(int a,int b,int md){
            int res=1;
            while(b){
                if(b%2==1)
                    res=(long long)res*a%md;
                b/=2;
                a=(long long)a*a%md;
            }
            return res%md;
        }
    int main()
    {
        cin>>a>>b>>p;
        cout<<quick_pow(a,b,p);
        return 0;
    } 
    

    信息

    ID
    2
    时间
    1000ms
    内存
    128MiB
    难度
    8
    标签
    递交数
    3669
    已通过
    582
    上传者