Chocolate Division*
Question
Solution
Idea
This is a pretty awesome question to test your math thinking a.k.a pattern recognition! The easiest way to solve this question is to use the idea of total_cut, which means how many available cuts for a bar of chocolate have given that it is . The answer is
Known that, since Alf plays first, we can easily find the pattern, which makes sense in our mind also
If
total_cutis odd, that means Alf will win. (It is easy to understand)Otherwise, Beata will win.
Code
https://github.com/mendax1234/Coding-Problems/blob/main/kattis/chocolatedivision/chocolatedivision.c
Last updated