fastmod即是唯一真神

int Mod;
struct fastmod{} mod;
unsigned long long iMod;
ll operator %(ll x,fastmod) {
    x-=ll((__int128_t)x*iMod>>64)*Mod+Mod;
    return x+(Mod&(x>>63));
}
//......
Mod=read();
iMod=(unsigned long long)-1/Mod;
posted @ 2022-08-09 21:18  Gooder  阅读(113)  评论(0)    收藏  举报