First, solve the problem. Then, write the code. ” - John Johnson

It's not at all important to get it right the first time. It's vitally important to get it right the last time. ” - Andrew Hunt and David Thomas

Sunday, July 20, 2014

Packing for Holiday.

Author : Jisan
Programming language : Java 
Difficulty : Easy
Status : Accepted
Problem number : UVA-12372
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3794

Code:

import java.util.*;
public class Uva_12372 {

public static void main(String[] args) {
Scanner in=new Scanner(System.in);
while(in.hasNext()){
int a=in.nextInt();
int Case=0;
for(int i=1;i<=a;i++){
int L=in.nextInt();
int W=in.nextInt();
int H=in.nextInt();
Case++;
if(L<=20 && W <=20 && H<=20){
System.out.println("Case "+ (Case)+":"+" good");
}else{
System.out.println("Case "+ (Case)+":"+" bad");
}
}
}

}

}

No comments:

Post a Comment