0

Equal Coin problem code working perfectly but got wrong answer why?

int T = scan.nextInt(); if(T>=1||T<=1000){ while(T-->0){ int x = scan.nextInt(); int y = scan.nextInt(); if((x>=0||x<=100000000)&&(y>=0||y<=100000000)){ if((x+y)>0){ if(((x>1)&&(x%2==0))&&(y==0)){ out.println("YES"); }else if((x==0)&&(y>1)){ out.println("YES"); }else if(((x>1)&&(x%2==0))&&y>1){ out.println("YES"); }else{ out.println("NO"); } } } } } Please tell me any test case which make it wrong ............

5th Nov 2021, 8:54 PM
Sakib X Hossain
Sakib X Hossain - avatar
2 odpowiedzi
+ 3
Sakib X Hossain , welcome on sololearn. just 10 min after getting started with sololearn, and posting this code - wow! if you really have a problem, we need some more details from you: ▪︎give a clear and complete description about your task ▪︎if your question is related to an exercise in a tutorial, please mention the tutorial name and the lesson number ▪︎if there are error messages please post them here ▪︎give at least one sample with input data and the expected output ▪︎to be able to find out the issues you have, we need to see your COMPLETE code     => please put your code in playground, save it there and post a link to it here. thanks for your understanding!
5th Nov 2021, 9:21 PM
Lothar
Lothar - avatar
+ 3
Sakib X Hossain You may want to start by rechecking that if statement. It looks like you want an int value from 1 to 1000, but that isn't what the if statement will return true for. It will return true for ANY value greater than or equal to 1, or, ANY value less than or equal to 1000. Which is the same as saying if ANY value return true. You may want to follow this logic and double check your remaining if statements to see if they are behaving as desired as well.
5th Nov 2021, 10:28 PM
ChaoticDawg
ChaoticDawg - avatar