abouttr3

Problem A (proquest 2013)

Jun 10th, 2013
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.96 KB | None | 0 0
  1. public class ProblemA{
  2.     public static void main(String []args){
  3.         java.util.Scanner in=new java.util.Scanner(System.in);
  4.         StringBuffer sb=new StringBuffer();
  5.        
  6.         int m=in.nextInt();
  7.         int x,y;
  8.         for(int i=0;i<m;i++){
  9.             x=in.nextInt();
  10.             y=in.nextInt();
  11.            
  12.             if(allEvenNumber(x+y)&&allEvenNumber(x*y)){
  13.                 sb.append("Case #"+(i+1)+": Win\n");
  14.             }
  15.             else{
  16.                 sb.append("Case #"+(i+1)+": Lose\n");
  17.             }
  18.         }
  19.         System.out.print(sb.toString());
  20.         System.exit(0);
  21.     }
  22.     public static boolean allEvenNumber(int n){
  23.         if(n!=0){
  24.             int x=n%10;
  25.             if(x%2==0){
  26.                 n=(n-x)/10;
  27.                 return allEvenNumber(n);
  28.             }
  29.             else{
  30.                 return false;
  31.             }
  32.         }
  33.         else{
  34.             return true;
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment