📜  在 cpp 中将两个数字相乘 <=10^18 %m - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:46.495000             🧑  作者: Mango

代码示例1
long long mul(long long a, long long b){
    if(b == 0)
        return 0;
    if(b & 1)
        return (mul(a, b - 1) + a) % mod;
    long long half = mul(a, b >> 1);
    return (half + half) % mod;
}
/* Credits tr0j4n034 at github as solution of MAS from spoj*/