import java.util.HashMap; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); HashMap<Integer, Integer> map = new HashMap<>(); map.put(1, 1); map.put(2, 1); map.put(4, 1); map.put(8, 1); map.put(16, 1); map.put(32, 1); map.put(64, 1); map.put(128, 1); map.put(256, 1); map.put(512, 1); map.put(1024, 1); map.put(2048, 1); map.put(4096, 1); map.put(8192, 1); map.put(16384, 1); map.put(32768, 1); map.put(65536, 1); map.put(131072, 1); map.put(262144, 1); map.put(524288, 1); while (scanner.hasNext()) { Integer get = Integer.valueOf(scanner.nextLine()); if (get <= 3) { if (get == 2 || get == 1) { System.out.println("Yes"); } else { System.out.println("No"); } } else { if ((get - 3) % 2 == 0 || get % 2 == 0) { if (map.getOrDefault((get - 3), 0) == 1 || map.getOrDefault(get, 0) == 1) { System.out.println("Yes"); } else { System.out.println("No"); } } else { System.out.println("No"); } } } } } |
Double click to view unformatted code.