int pow3(int x,int n)
{
if(n==0) return 1;
else
{
while((n&1)==0)
{
n>>=1;
x*=x;
}
}
int result=x;
n>>=1;
while(n!=0)
{
x*=x;
if((n&1)!=0)
result*=x;
n>>=1;
}
return result;
}
快速幂
最新推荐文章于 2025-04-07 00:18:15 发布