whoashish's cp notes

Home

❯

13. Mathematics

13. Mathematics

Oct 08, 20261 min read

  • i. Modular Arithmetic: Work in Zm​:
  • ii. Barrett and Montgomery Reduction: % by a run-time divisor costs 20–90 cycles; the compiler only turns division by a compile-time constant into multiplications.
  • iii. Probability and Expectation: Almost every expectation problem is solved by one of:
  • iv. Contest Mathematics: The math that contest problems assume without naming it.

4 items under this folder.

  • Oct 08, 2026

    i. Modular Arithmetic

    • math
    • modular-arithmetic
    • binary-exponentiation
    • inverses
    • factorials
  • Oct 08, 2026

    ii. Barrett and Montgomery Reduction

    • math
    • barrett
    • montgomery
    • mulmod
    • constant-factor
  • Oct 08, 2026

    iii. Probability and Expectation

    • math
    • probability
    • expectation
    • martingales
    • markov-chains
  • Oct 08, 2026

    iv. Contest Mathematics

    • math
    • contest-math