Boy and Chocolates
CodeChefOpen on judge ↗
A boy wants to buy $X$ chocolates from the shop. He has to pay $Y$ dollars for the first chocolate, $2Y$ dollars for the second one and so on (in other words, he has to pay $i$*$K$ dollars for the $i$$th$ chocolate). He has $N$ dollars. How many dollars does he have to borrow from his friend to buy $X$ chocolates? ###Input: - A single line containing three spaced integers $Y$, $N$ and $X$, the p
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