J.java 526 B

123456789101112131415161718192021
  1. import java.util.Scanner;
  2. public class J {
  3. static boolean check(int n) {
  4. int tot = 0;
  5. for (int i = 2; i < n; i++)
  6. if (n % i == 0)
  7. ++tot;
  8. return tot <= 2 && tot > 0;
  9. }
  10. public static void main(String[] args) {
  11. Scanner cin = new Scanner(System.in);
  12. for (int t = cin.nextInt(); t-- > 0; ) {
  13. if (check(cin.nextInt()))
  14. System.out.println("Yes");
  15. else
  16. System.out.println("No");
  17. }
  18. }
  19. }