a的b次方对c取余可以写成下面的形式
int ans = 1; while (b−−){ ans = ( ans∗a)%c ; }
数学不好,求大神解释一下
走同样的路,发现不同的人生
Because the mod is multiplier
Suppose a=mq+r, b=nq+s. Then
(a*b) mod q = (mnq^2+msq+nrq+rs) mod q = rs mod q = ((a mod q) * (b mod q)) mod q
The phone code is a bit confusing
Because the mod is multiplier
Suppose a=mq+r, b=nq+s. Then
The phone code is a bit confusing