Competitive programming contest 355
Competitive programming contest 355 holds problems and solutions for a contest in a competitive-programming course at Chiang Mai University. Each problem comes with a statement, an explanation and test cases, 40 in all.
An example: Fibonacci modulo m
One problem asks for the *n*th Fibonacci number modulo m, for very large n. Computing the Fibonacci number first is hopeless at that size. The solution uses the Pisano period: the remainders of the Fibonacci sequence modulo m repeat in a cycle. So it finds the cycle's length and reduces n modulo that length first.
Engineering
The solutions are in C++ and C, built with CMake and a Makefile, formatted with clang-format and documented with Doxygen. GitHub Actions workflows check the code.