Social Icons

twitterfacebookgoogle pluslinkedinrss feedemail

Monday, August 27, 2012

BUBTPC 2nd Problem I - Boring Math Assignment


Boring Math Assignment

Problem Description:
Like all the other students in the class Rakib hates math assignment. Today his math teacher taught him about “Triangle”. A Triangle is a geometrical shape with three corners and three sides or edges which are line segments. After the class his teacher gave him some homework, where in every task he was given three line segments and he needed to answer whether these lines could form a triangle shape or not. Rakib didn’t want to do this assignment by himself; As you are a good computer programmer, he requests you to write a program that will output the answer “Yes”, if these line segments can form a triangle or “No” if these line segments cannot form a triangle for each of his tasks.

Input:
First line of the input is an integer number T (1<=T<=100) represents the number of tasks assigned to Rakib. For every task you need to take three lines as input. Every line is represented by its two end points (x1 y1) and (x2,y2). All the co-ordinates are integer and within -106 to 106.

Output:
For every task you need to output the result in a separate line. See sample input/output for more details.

Sample Input/output:
Sample input
Sample output
1
0 0 0 1
0 0 1 0
0 1 1 0
Yes



Explanation of sample case:
In the sample case there is only one task for Rakib. (0,0) (0,1) is the first line segment , (0,0) (1,0) is the second line segment and (0,1) (1,0) is the third line segment. Output for the sample input is “Yes” because the given line segments can form triangle.

Problem setter: Abu Obaida Opu, CSE
Bangladesh University of Business and Technology (BUBT)

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)

BUBTPC 2nd Problem G - Do You Have Enough Money?


Do You Have Enough Money?

Problem Description:
Riad is a student of BUBT. His hobby is shopping. When he goes for shopping he wants to buy whatever he sees. He always forgets how much money is in his hand. To overcome this problem he has decided to write a program that will read the amount of money he has and the prices of the items he wants to buy. Determine whether he has enough money to buy everything he selected or whether he is in short of money. If he does not have enough money, the program will indicate the amount of the shortfall.  In case of short of money the program also indicates the list of items he may buy with his money.

Input:
The first line contains a single integer N, which will denote the amount of money he has in his hand. The second line contains M(1<=M<=10) that indicates the number of items Riad is interested to buy. The third line contains price of each element that Riad is interested to buy.

Output:
In output there will be two lines. The first line shows whether Riad has enough money or not (print BUY ALL ITEM or SHORTFALL depending on the money in his hand). In case of shortfall print the amount of shortfall. The second line contains the list of items that Riad may buy in case of shortfall.

Sample Input/Output:
Sample Input
Sample Output
100
4
25   60  75  70

1000
5
25  60  100   85    50
SHORTFALL Tk: 130
YOU MAY BUY
75   25

BUY ALL ITEMS


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

Sample text

Sample Text