Summary count modulo operation class problems

Summary count modulo operation class problems

Benpian essay briefly explain Olympiad in Informatics in counting problems in class modulo arithmetic knowledge. Be regarded as a summary of the nature of the blog, the answer will be a brief time in the statistical count of the class how legitimate expression of modulo.

Adding

If the form \ ((a + b) \ , \, mod \, \, p \) formula, can become: \ (A \, \, MOD \, \, P + B \, \, MOD \, \, the p-\) .

Subtraction

Since the subtraction operation is a negative of the addition, subtraction modulo operation it satisfies the above equation:

\ ((ab) \, \ , mod \, \, p \) may become: \ (A \, \, MOD \, \, pb \, \, MOD \, \, the p-\) .

Multiplication

Multiplication can be considered an accumulation operation, the multiplication modulo arithmetic expressions above also meet the relevant adding operation:

That \ ((a \ times b) \, \, mod \, \, p \) may become \ (a \, \, mod \, \, p \ times b \, \, mod \, \, p \) .

Division

Division in mathematics has been a relatively unique operation, although it is also one of four mixed computing, but its operation is not the same.

Good words three times: not the same! Different! Different!

That is, \ ((A / B) \, \, MOD \, \, P \) is not equal to \ (\ frac {a \, \, mod \, \, p} {b \, \, mod \, \, P} \) .

It modulo algorithm is: molecular denominator multiplied by the multiplicative inverse .

That is:
\ [A / B \ equiv A \ B ^ {Times} 2-P \, \, \, (MOD \, \, P) \]

Exponentiation

In fact, I think we just need to pay attention to the modulo division, exponentiation modulo because it means continually multiply, and we have learned modulo arithmetic multiplication, then you only need to have to take up:

即:
\[ a^b\equiv (a\%p)^b\,\,\,(mod\,\,p) \]

Guess you like

Origin www.cnblogs.com/fusiwei/p/12061715.html