11389 - The Bus Driver Problem
Solution Description : Sorting Problem at first sort n morning bus routes A[] & n afternoon bus routes B[]. now the first pair is first one of morning bus route A[0] & Last one of afternoon bus route B[n-1] the second pair is second one of morning bus route A[1] & second last one of afternoon bus route B[n-2] and so on. You got total n pair if the sum of each pair is greater than d then overtime += (sum-d) At last print overtime*r |
||||||||||