← All problemsSign in

Minimal Usage

CodeChefRating 2018Open on judge ↗

Chef's bakery sells $N$ types of cakes, numbered from $1$ to $N$. The $i$-th type of cake has a weight of $i$ units. The bakery just received an order: a customer would like to buy **exactly** $K$ cakes with a **total weight** that equals $S$ units. There are no other restrictions - that is, the order can include any number of cakes of each type, as long as there are exactly $K$ cakes with th

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