Top

O(1)快速乘


1
2
3
4
inline long long multi(long long x,long long y,long long mod){
long long tmp=(x*y-(long long)((long double)x/mod*y+1.0e-8)*mod);
return tmp<0 ? tmp+mod : tmp;
}
文章版权为Anoyer博客所有,转载请以链接形式标明本文地址