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
New poster
Posts: 26
Joined: Fri Oct 28, 2011 2:42 am

12372 - Packing for Holiday

Post by outsbook »

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

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

12372 - Packing for Holiday

Post by DanDanR »

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?

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");
				System.out.println("Case " + i + ": good");

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 »

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

Post Reply

Return to “Volume 123 (12300-12399)”