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");
            }*/

        }


    }

}

 

posted @ 2022-03-14 17:57  紫英626  阅读(20)  评论(0编辑  收藏  举报

紫英