The problem is Atcoder's B-Crane and Turtle's turtle calculation problem. https://atcoder.jp/contests/abc170/tasks/abc170_b
qiita.turukame
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int x = scan.nextInt();
int y = scan.nextInt();
int flag = 0;
for (int i = 0; i <= x; i++){
if ((y-2*i)%4 == 0 && (y - 2 * i)/4 == x-i){
flag++;
System.out.println("Yes");
break;
}
}
if (flag == 0){
System.out.println("No");
}
}
}
this,,,, (Code review by saka1029!)
qiita.turukamekai
public class main {
static boolean tsurukame(int x, int y) {
return y % 2 == 0 && y >= 2 * x && 4 * x >= y;
}
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int x = scan.nextInt();//Animal
int y = scan.nextInt();//Number
System.out.println(tsurukame(x, y) ? "yes" : "no");
}
}