See the definition of the ACM-ICPC series of number theory, the modulo operation is such a son.
Given a positive integer p, any integer n, there must be an equation: n = kp + R, where K, R is an integer, and 0≤r < P, then K is the quotient of n divided by P, and R is n divided by the remainder of P. The implication is that the remainder must be >0 so unhappy, wrote a program test under:
1printf"(7) MOD5 =%d\n",7%5);2printf"( -7) MOD5 =%d\n",(-7)%5);3printf"(7) MOD ( -5) =%d\n",7%(-5));4printf"( -7) MOD ( -5) =%d\n",(-7)%(-5));
The result is:
It's totally different, it's subverting my worldview.
Baidu behind the next only to find the original.
The two concepts of the modulo operation ("Modulo operation") and the Take-rest operation ("remainder operation") have overlapping parts but are not identical. The main difference is that there are different operations when dividing a negative integer into a division operation.
In addition, the meaning of the% operator in each environment is different, for example, C/c++,java is the remainder, while Python is the modulo.
Then, after the call to take the surplus, not called to take the mold.
Number theory-taking modulo, seeking redundancy?