STATION MASTER AND COST
CodeChefOpen on judge ↗
There are $N$ stations numbered $1, 2, ..., N$ connected to each other by $N-1$ tracks. Station Master wants to go somewhere and CHEF has advised him to go to the station at $maximum$ $distance$ from his current station. Now, station master is charged $M$ money for every track he travels. He wants to know the $amount$ of money he will be charged for this travel. He is not good in maths. So,
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