16 条题解

  • 2
    @ 2026-5-31 17:31:58

    一定AC

    using namespace std;
    int a,b,p;
    int quicky_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<<quicky_pow(a,b,p);
    	return 0;	
    } 
    

信息

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