結果

問題 No.135 とりあえず1次元の問題
ユーザー abcabc
提出日時 2016-11-08 02:45:51
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 643 bytes
コンパイル時間 1,852 ms
コンパイル使用メモリ 72,148 KB
実行使用メモリ 61,148 KB
最終ジャッジ日時 2023-09-02 00:38:45
合計ジャッジ時間 8,447 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 558 ms
60,792 KB
testcase_01 AC 123 ms
55,652 KB
testcase_02 AC 118 ms
55,516 KB
testcase_03 WA -
testcase_04 AC 130 ms
56,380 KB
testcase_05 AC 128 ms
55,820 KB
testcase_06 AC 128 ms
55,824 KB
testcase_07 AC 128 ms
55,844 KB
testcase_08 AC 131 ms
55,568 KB
testcase_09 AC 131 ms
55,572 KB
testcase_10 AC 129 ms
55,580 KB
testcase_11 AC 127 ms
55,572 KB
testcase_12 AC 155 ms
55,944 KB
testcase_13 AC 131 ms
56,088 KB
testcase_14 AC 176 ms
56,188 KB
testcase_15 AC 153 ms
55,524 KB
testcase_16 AC 179 ms
56,056 KB
testcase_17 AC 178 ms
55,996 KB
testcase_18 AC 136 ms
55,796 KB
testcase_19 AC 178 ms
56,124 KB
testcase_20 AC 176 ms
56,152 KB
testcase_21 AC 502 ms
60,816 KB
testcase_22 AC 556 ms
61,148 KB
evil01.txt AC 540 ms
61,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package sample;

import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] x = new int[n];

        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
        }

        Arrays.sort(x);

        int first = x[0];
        //int i = 1;
        int min = Integer.MAX_VALUE;

        for (int i = 0; i < n - 1; i++) {

            if (0 < (x[i + 1] - x[i])) {

                min = Math.min(min, x[i + 1] - x[i]);

            }

        }

        System.out.println(min);

    }

}
0