Social Icons

twitterfacebookgoogle pluslinkedinrss feedemail

Monday, August 27, 2012

BUBTPC 2nd Problem H - Reach Office in Time


Reach Office in Time

Problem Description:
Fahad is a job holder. He lives in Mirpur-06. His office is in Motijheel. Everyday he goes from Mirpur to Motijheel through Mirpur10-Faremgat-Motijheel way. There are many options to go to his office. The time and the cost of different options are not the same. For example, there are three ways. The cost and time needed for these ways are:
                    Cost                              Time
300                                                 45 mins            
200                                                 60 mins
30                                                  120 mins           
Fahad’s office starts at 10 A M. Before starting for the office he measures the time he has and the time he needs to go to the office. Then he chooses the one of the options. As a programmer you are invited to write a program to find the options that Fahad can use to go office in time. Also find the best option (Best option is the option by which Fahad can reach office at least 15 minutes before the office starts at a minimum cost).

Input:
The first line of input will contain a number N(1<=N<=10), that will denote the number of sample we will entry. The second line contains the cost and time of each option. This will continue for N times. The third line contains how much time is left to reach office.  Use two dimensional arrays for the program.

Output: 
The output shows two things. This shows the available options to reach the office in time with the respective costs. In case of more than one option, this will also show the best option.

Sample Input/Output:
Sample Input
Sample Output
3

45        60        120
300      200       30
TIME TO LEFT: 100
OPTIONS TO REACH OFFICE TIMELY ARE:
45       60
300     200
Best Option:
60     200

Problem setter: Md. Saifur Rahman, Asst. Professor, Dept. of CSE
Bangladesh University of Business and Technology (BUBT)

No comments:

Post a Comment

 

Sample text

Sample Text