贝壳笔试...我怕是有毒
  本地IDE测试都跑了...提交0AC,写的测试用例输出为空...用不明白的在线编辑器 
 public static void main(String args[]){
       // Scanner n = new Scanner(System.in);
        Scanner firstInt = new Scanner(System.in);
       Scanner in  = new Scanner(System.in);
        int n = firstInt.nextInt();
        if (n == 0) {
            System.out.println(0);
        }
        else if (n == 1){
            int[] b = new int[n];
            for (int i = 0; i < b.length; i++) {
                b[i] = in.nextInt();
            }
            System.out.println(b[0]);
        }
        else {
       int[] b = new int[n];
        for (int i = 0; i < b.length; i++) {
            b[i] = in.nextInt();
        }
       int first = 0;
       int scond = 0;
        int temp = 10000;
       int a = 0;
        for (int i = 1; i < b.length; i++) {
            int firstnum = b[i-1];
            int scondnum = b[i];
            a = Math.abs(firstnum - scondnum);
            if(a < temp){
                temp = a;
                first = i-1;
                scond = i;
            }
//            if (a <= temp){
//
//            }
        }
        System.out.println(b[first] +" " + b[scond]);
    }} public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        //arr数组表示输入的序列
        int[] arr = new int[11111];
        //longest数组中存放上升序列的长度,longest[i]表示以arr[i]结尾的子序列的最大长度
        int[] longest = new int[11111];
        for (int i = 1; i <= n; i++) {
            int a = sc.nextInt();
            arr[i] = a;
        }
        int result = -1;
        for (int i = 1; i <= n; i++) {
            longest[i] = 1;
            for (int j = 1; j < i; j++) {
                if (arr[i] > arr[j] && (longest[j] + 1 > longest[i])) {
                    longest[i] = longest[j] + 1;
                }
            }
            result = Math.max(result, longest[i]);
        }
        System.out.println(result);
    } public static void main(String args[]){
            Scanner firstInt = new Scanner(System.in);
            Scanner in  = new Scanner(System.in);
            int n = firstInt.nextInt();
            int[] array = new int[n];
            for (int i = 0; i < array.length; i++) {
                array[i] = in.nextInt();
            }
           //int[] array = {1,1,1,1,1};
           int count = 0;
            for (int i = 0; i < array.length; i++) {
                for (int j = i; j < array.length - 1; j++) {
                    if (array[i] > array[j]){
                        if (array[i] * 0.9 <= array[j])
                        {
                            count++;
                        }
                    }
                    if (array[i] < array[j]){
                        if (array[i]  >= array[j]* 0.9)
                        {
                            count++;
                        }
                    }
                    if (array[i] == array[j]){
                        count++;
                    }
                }
            }
            System.out.println(count);
        }  投递大连飞创信息技术有限公司等公司10个岗位
投递大连飞创信息技术有限公司等公司10个岗位

 查看18道真题和解析
查看18道真题和解析