← All problemsSign in

Let Me Eat Cake!

CodeChefRating 753Open on judge ↗

Alice and Bob both bought a full cake each. Alice's cake has $A$ slices, and Bob's cake has $B$ slices. Alice will be unhappy if she has *strictly less* slices than Bob does. Similarly, Bob will be unhappy if he has strictly less slices than Alice does. Charlie doesn't want either of his friends to be unhappy, so he proposes a solution: while either Alice or Bob are unhappy, he will attemp

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