Weighted Necklace
CodeChefOpen on judge ↗
You are given $K$ different colors of beads. A bead of the $i$-th color has a weight $w_i$. You have infinitely many beads of each color. All the beads of the same color have the same weight. You have to answer $q$ independent queries. For each query, you will be given $S$. You have to form a necklace consisting of $n$ beads such that the total weight of the necklace is $S$. You can use any numbe
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