← All problemsSign in

Cake Cutting

CodeChefRating 2560Open on judge ↗

Baker Ronald is preparing a celebration cake for Leo because he conquered the world. Ronald already has the base ready, and now he is aiming to make a multi-flavored cake. Ronald's cake is circular. He has placed $M$ cherries uniformly on the circumference of the cake. The cherries are numbered $1$ to $M$ **anticlockwise**. He also has $N$ different types of flavored creams, and decides to pu

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start