9 Modulo 10. Therefore 24 and 34 are congruent modulo 10. Given two numbers, a (the dividend) and n (the divisor), a modulo n (abbreviated as a mod n) is the remainder from the division of a by n.
( a + b) % c = ( ( a % c ) + ( b % c ) ) % c. Modulo 10^9+7 (1000000007) in most of the programming competitions, problems are required to answer the result in 10^9+7 modulo. The remainder of the division is subtracted from 10.
In fact, any prime number less than 2^30 will be fine in order to prevent possible overflows.
Here is the math to illustrate how to get 1 mod 10 using our modulo method: In fact, any prime number less than 2^30 will be fine in order to prevent possible overflows. Using the same , , , and as above, we would have: 10^9 + 7 fits both criteria;
Nessun commento:
Posta un commento