分数取模

a^-1 mod p 就是 我们要求的,这个值的结果恒等于  a^p-2 mod p

inline int ksm(int x,int y){
    int ans1=1;while (y){
        if (y&1) ans1=1ll*ans1*x%Mod;
        y>>=1;x=1ll*x*x%Mod;
    }return ans1;
}

比如E/V 对MOD 取余就是  E*ksm(V,MOD-2)%MOD;

原文地址:https://www.cnblogs.com/qq-1585047819/p/11141684.html