Professional Documents
Culture Documents
The appearance of mathematics problems in programming contests is not surprising since Computer
Science is deeply rooted in Mathematics. The term ‘computer’ itself comes from the word ‘compute’
as computer is built primarily to help human compute numbers.
We are aware that different countries have different emphasis in mathematics training in pre-
University education. Thus, for some newbie ICPC contestants, the term ‘Euler Phi’ is a familiar
term, but for others, the term does not ring any bell. Perhaps because he has not learnt it before, or
perhaps the term is different in his native language. In this chapter, we want to make a more level-
playing field for the readers by listing common mathematic terminologies, definitions, problems,
and algorithms that frequently appear in programming contests.
1. UVa 344 - Roman Numerals (conversion from roman numerals to decimal and vice versa)
2. UVa 377 - Cowculations (base 4 operations)
3. UVa 10346 - Peter’s Smoke (simple math)
4. UVa 10940 - Throwing Cards Away II (find pattern using brute force, then use the pattern)
5. UVa 11130 - Billiard bounces (use billiard table reflection technique)
6. UVa 11231 - Black and White Painting (use the O(1) formula once you spot the pattern)
7. UVa 11313 - Gourmet Games (similar to UVa 10346)
8. UVa 11428 - Cubes (simple math with complete search)
9. UVa 11547 - Automatic Answer (one liner O(1) solution exists)
10. UVa 11723 - Numbering Road (simple math)
11. UVa 11805 - Bafana Bafana (very simple O(1) formula exists)
94