Programming contests

Magas szintű programozási nyelvek 1, 2015. április 15., Sz12 ZH

April 15, 2015 12:05 PM – April 15, 2015 1:45 PM

Packing for Holiday

Mr. Bean has a lot of problems packing his suitcase for holiday. So he is very careful for this coming holiday. He is more serious this time because he is going to meet his fiance. He is also keeping frequent communication with you as a programmer friend to have suggestions. He gets confused when he buys a gift box for his fiance because he can't decide whether it will fit in his suitcase or not. Sometimes a box doesn't fit in his suitcase in one orientation, but after rotating the box to a different orientation, it fits in the suitcase. This type of behavior makes him puzzled.

So to make things much simpler, he bought another suitcase having the same length, width, and height, which is 20 inches. This measurement is taken from inside of the suitcase, i.e., a box with a length, width, and height of 20 inches will just fit in this suitcase. He also decided to buy only rectangular shaped boxes and keep a measuring tape in his pocket. Whenever he chooses one gift box, which must be rectangular shaped, he quickly measures the length, width, and height of the box. But still he can't decide whether it will fit in his suitcase or not. Now he needs your help. Please write a program for him which calculates whether a rectangular box fits in his suitcase or not, provided the length, width, and height of the box. Note that the sides of the box must be parallel to the sides of the suitcase.

Input Specification

The input starts with an integer T (T ≤ 100), which indicates the number of test cases.

Each of the next T lines contains three integers L, W, and H (1 ≤ LWH ≤ 50) denoting the length, width, and height of a rectangular shaped box, respectively.

Output Specification

For each test case, output a single line. If the box fits in the suitcase in any orientation, the sides of the box being parallel to the sides of the suitcase, this line will be “Case #: good”, otherwise it will be “Case #: bad”. In your output, # will be replaced with the case number.

Please see the sample input and sample output for the exact format.

Sample Input

  1. 2
  2. 20 20 20
  3. 1 2 21
download as text file

Output for Sample Input

  1. Case 1: good
  2. Case 2: bad
download as text file
University of Debrecen; Faculty of Informatics; v. 03/01/2019