← All problemsSign in

Food Balance

CodeChefRating 215Open on judge ↗

Chef is preparing to cook his dinner. There are two dishes Chef can make. The first one contains $F_1$ grams of fat and $P_1$ grams of protein, while the second contains $F_2$ grams of fat and $P_2$ grams of protein. Chef would like the quantity of fats and proteins he consumes to be as close to each other as possible, i.e., the absolute difference between the amount of fats and proteins should

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