BUY CHOCOLATES
CodeChefOpen on judge ↗
Sonal and Mamta are two friends and want to buy some chocolates which are sold at price z rupees per chocolate. Sonal has x rupees, mamta has y rupees. Each girl will buy as many chocolates as she can using only her money. This way each girl will buy an integer non-negative number of chocolates. The girls discussed their plans and found that the total number of chocolates they buy can increase (
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.
Sign in to chat with the tutor and save your progress.
Sign in to start