标签:turn cli play long while code view alt show
//O(1)快速乘 inline LL quick_mul(LL x,LL y,LL MOD){ x=x%MOD,y=y%MOD; return ((x*y-(LL)(((long double)x*y+0.5)/MOD)*MOD)%MOD+MOD)%MOD; } //O(log)快速乘 inline LL quick_mul(LL a,LL n,LL m) { LL ans=0; while(n) { if(n&1) ans=(ans+a)%m; a=(a<<1)%m; n>>=1; } return ans; }
O(1) 的有误差的 , 在mod 很大的时候不推荐用
标签:turn cli play long while code view alt show
原文地址:https://www.cnblogs.com/shuaihui520/p/10545667.html