if L >20 or W>20 or H>20 then bad
else good
12372 - Packing for Holiday
Moderator: Board moderators
12372 - Packing for Holiday
"Learning to love yourself is the greatest love of all" - Michael Masser and Linda Creed
12372 - Packing for Holiday
Hey guys,
this is the easiest problem ever. As I understand it Mr. Bean has got a suitcase with 20x20x20 inches in size. So just check whether any of the dimensions of the gift box is >20 inxhes -> doesn't fit. Else -> does fit. Why do I keep getting wrong answer, am I confusing sth here? It does work perfectly with the given sample input. Can somebody help me out?
Thanks!
Ma code so far:
this is the easiest problem ever. As I understand it Mr. Bean has got a suitcase with 20x20x20 inches in size. So just check whether any of the dimensions of the gift box is >20 inxhes -> doesn't fit. Else -> does fit. Why do I keep getting wrong answer, am I confusing sth here? It does work perfectly with the given sample input. Can somebody help me out?
Thanks!
Ma code so far
Code: Select all
import java.util.*;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
int i, t;
int h, l, w;
final int maxDimension = 20;
Scanner sc = new Scanner(System.in);
t = sc.nextInt();
for(i=0; i<t; i++) {
l = sc.nextInt();
w = sc.nextInt();
h = sc.nextInt();
if((h > maxDimension) || (l > maxDimension) || (w > maxDimension))
System.out.println("Case " + i + ": bad");
else
System.out.println("Case " + i + ": good");
}
sc.close();
return;
}
}
-
- New poster
- Posts: 6
- Joined: Sat Dec 01, 2012 2:52 pm
Re: 12372 - Packing for holiday - easiest problem ever, no A
u have forgotten to display a new line after each test case 
