Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ProblemA{
- public static void main(String []args){
- java.util.Scanner in=new java.util.Scanner(System.in);
- StringBuffer sb=new StringBuffer();
- int m=in.nextInt();
- int x,y;
- for(int i=0;i<m;i++){
- x=in.nextInt();
- y=in.nextInt();
- if(allEvenNumber(x+y)&&allEvenNumber(x*y)){
- sb.append("Case #"+(i+1)+": Win\n");
- }
- else{
- sb.append("Case #"+(i+1)+": Lose\n");
- }
- }
- System.out.print(sb.toString());
- System.exit(0);
- }
- public static boolean allEvenNumber(int n){
- if(n!=0){
- int x=n%10;
- if(x%2==0){
- n=(n-x)/10;
- return allEvenNumber(n);
- }
- else{
- return false;
- }
- }
- else{
- return true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment