12372 - Packing for Holiday

All about problems in Volume 123. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
User avatar
outsbook
New poster
Posts: 26
Joined: Fri Oct 28, 2011 2:42 am

12372 - Packing for Holiday

Post by outsbook » Tue Nov 22, 2011 5:05 pm

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

Post by DanDanR » Sun Nov 17, 2013 2:01 pm

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

Post by AbdAllah Boda » Mon Nov 18, 2013 6:41 pm

u have forgotten to display a new line after each test case :D

Post Reply

Return to “Volume 123 (12300-12399)”