12372 - Packing for Holiday

来源:互联网 发布:最后的吸血鬼 知乎 编辑:程序博客网 时间:2024/05/02 13:21
Mr. Bean used to have a lot ofproblems packing his suitcase for holiday. So he is very careful for thiscoming holiday. He is more serious this time because he is going to meet his fiancéeand he is also keeping frequent communication with you as a programmer friendto have suggestions. He gets confused when he buys a gift box for his fiancéebecause he can't decide whether it will fit in his suitcase or not. Sometimes abox doesn't fit in his suitcase in one orientation and after rotating the boxto a different orientation it fits in the suitcase. This type of behavior makeshim puzzled.

 

So to make things much simpler hebought another suitcase having same length, width and height, which is 20inches. This measurement is taken from inside of the box. So a box which haslength, width and height of 20 inches will just fit in this suitcase. He alsodecided to buy only rectangular shaped boxes and keep a measuring tape in hispocket. Whenever he chooses one gift box, which must be rectangular shaped, hequickly measures the length, width and height of the box. But still he can'tdecide 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 fitsin his suitcase or not provided the length, width and height of the box. Notethat, sides of the box must be parallel to the sides of the suitcase.

 

Input

Input starts with an integer T (T ≤ 100), which indicatesthe number of test cases.

 

Each of the next T line containsthree integers L, W andH (1 ≤ L, W, H ≤ 50) denoting the length,width and height of a rectangular shaped box.

 

Output

For each test case, output asingle line. If the box fits in the suitcase in any orientation having thesides of the box is parallel to the sides of the suitcase, this line will be“Case #: good”, otherwise it willbe“Case #: bad”. In youroutput# will be replacedby the case number.

 

Please see the sample input and sample output for exactformat.

 

SampleInput                               Output for Sample Input

2

20 20 20

1 2 21

                                                    Case 1: good

                                                    Case 2: bad

#include<stdio.h>int main(){int t,l,w,h,count=1;scanf("%d",&t);while(t--){scanf("%d%d%d",&l,&w,&h);printf("Case %d: ",count++);if(l<=20&&w<=20&&h<=20) puts("good");else puts("bad");}return 0;}

原创粉丝点击