← All problemsSign in

Nearest Exit

CodeChefRating 585Open on judge ↗

There are two exits in a bus with $100$ seats: - First exit is located beside seat number $1$. - Second exit is located beside seat number $100$. Seats are arranged in a straight line from $1$ to $100$ with equal spacing between any $2$ adjacent seats. A passenger prefers to choose the nearest exit while leaving the bus. Determine the exit taken by passenger sitting on seat $X$. ### Input - 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