Algorithm of 11389 - The Bus Driver Problem

Problem Description Link
Algorithm:
This is a simple problem . The problem say that
In a city there are n bus drivers. Also there are n morning bus routes & n afternoon bus routes with various lengths. Each driver is

assigned one morning route & one evening route. For any driver, if his total route length for a day exceeds d, he has to be paid

overtime for every hour after the first d hours at a flat r taka / hour. Your task is to assign one morning route & one evening route

to each bus driver so that the total overtime amount that the authority has to pay is minimized.
How ever you can follow this to solve the problem
for this problem you need n,d,r
get input n time in morning array ntime evening array
sort each array and get length by adding first element of morning
and last element of evening and chaeck length > d or not
if  >  then count extra hour finally hour*r result
image

No comments:

Post a Comment

Write your comment - Share Knowledge and Experience