← All problemsSign in

Solve Equations

You are given a straight line, a.x + b.y = c . Find the point closest to the origin that also satisfies the following properties: x and y are integers. x is greater than zero. If more than one solution exists satisfying 1 and 2, then choose the point in which is minimal. Given q queries consisting of aᵢ, bᵢ and cᵢ, find and print the point satisfying the above conditions for each respective q

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