## 12372 - Packing for Holiday

Moderator: Board moderators

outsbook
New poster
Posts: 26
Joined: Fri Oct 28, 2011 2:42 am

### 12372 - Packing for Holiday

if L >20 or W>20 or H>20 then bad
else good
"Learning to love yourself is the greatest love of all" - Michael Masser and Linda Creed

DanDanR
New poster
Posts: 2
Joined: Sat Nov 16, 2013 11:43 pm

### 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

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;
}
}
``````
:

AbdAllah Boda
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