fork download
  1. import java.util.*;
  2. import java.util.regex.*;
  3. public class Main
  4. {
  5. public static void main(String[] args) {
  6. Scanner sc = new Scanner(System.in);
  7. int t = sc.nextInt();
  8. sc.nextLine();
  9. while (t-- > 0) {
  10. solve(sc);
  11. }
  12. sc.close();
  13. }
  14.  
  15. public static void solve(Scanner sc)
  16. {
  17. String n=sc.nextLine();
  18. Pattern pattern = Pattern.compile("(?=.*0)(?=.*1)");
  19. Matcher matcher = pattern.matcher(n);
  20. if(matcher.find())
  21. {
  22. int g=Integer.parseInt(n);
  23. System.out.println("YES");
  24. }
  25. else
  26. {
  27. int g=Integer.parseInt(n);
  28. if(g%11==0)
  29. System.out.println(g+"YES");
  30. else
  31. System.out.println("NO");
  32. }
  33.  
  34. }
  35.  
  36. }
  37.  
  38.  
Success #stdin #stdout 0.17s 58988KB
stdin
11
121
1
14641
12221
10110
100000
99
112
2024
12421
1001
stdout
121YES
NO
14641YES
12221YES
YES
YES
99YES
NO
2024YES
NO
YES