快速幂

xiaoxiao2021-02-28  105

LL Q_pow(LL x,LL n,LL MOD) { LL res=1; while(n>0) { if(n&1) res=res*x%MOD;//二进制最低位为1,则乘上x^(2^i) x=x*x%MOD; n>>=1; } return res; }
转载请注明原文地址: https://www.6miu.com/read-24393.html

最新回复(0)