← All problemsSign in

Buy 2 Get 1 Free

CodeChefRating 821Open on judge ↗

There is a sale going on in Chefland. For every $2$ items Chef pays for, he gets the **third** item for **free** (see sample explanations for more clarity). It is given that the cost of $1$ item is $X$ rupees. Find the **minimum** money required by Chef to buy at least $N$ items. ### Input - First line will contain $T$, number of test cases. Then the test cases follow. - Each test case contains

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