3.12美团
1.幸运数字
class Test { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("输入的数字数量:"); int n = scanner.nextInt(); String[] s = new String[n]; for (int i = 0; i < s.length; i++) { s[i] = scanner.next(); } isLucky(s); } public static void isLucky(String[] s){ for (String s1 : s) { int num = Integer.parseInt(s1); int count = 0; //int ge = num/100; //int shi = num/10%10; //int bai = num/100; char[] chars = s1.toCharArray(); for (char aChar : chars) { if ('1'==aChar){ ++count; } } if (num % 11 == 0){ System.out.println("yes"); }else if (count >= 2){ System.out.println("yes"); }else { System.out.println("no"); } /*else if (num == 111){ System.out.println("yes"); }else if ((ge == 1 && shi ==1)||(ge ==1 && bai ==1) || (shi ==1 && bai ==1)){ System.out.println("yes"); }*/ } } }
本文来自博客园,作者:紫英626,转载请注明原文链接:https://www.cnblogs.com/recorderM/p/16005117.html