結果

問題 No.135 とりあえず1次元の問題
ユーザー dazydazy
提出日時 2016-09-14 04:23:35
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 533 bytes
コンパイル時間 5,108 ms
コンパイル使用メモリ 72,928 KB
実行使用メモリ 60,764 KB
最終ジャッジ日時 2023-09-02 00:31:58
合計ジャッジ時間 11,120 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 551 ms
60,312 KB
testcase_01 AC 118 ms
55,676 KB
testcase_02 WA -
testcase_03 AC 119 ms
55,504 KB
testcase_04 WA -
testcase_05 AC 131 ms
56,352 KB
testcase_06 AC 125 ms
56,364 KB
testcase_07 AC 131 ms
55,636 KB
testcase_08 AC 128 ms
56,004 KB
testcase_09 WA -
testcase_10 AC 129 ms
56,188 KB
testcase_11 AC 129 ms
55,908 KB
testcase_12 AC 158 ms
55,756 KB
testcase_13 AC 132 ms
56,012 KB
testcase_14 AC 179 ms
55,800 KB
testcase_15 AC 157 ms
55,832 KB
testcase_16 WA -
testcase_17 AC 180 ms
55,892 KB
testcase_18 AC 137 ms
55,856 KB
testcase_19 AC 180 ms
56,204 KB
testcase_20 AC 173 ms
55,724 KB
testcase_21 WA -
testcase_22 AC 566 ms
60,456 KB
evil01.txt AC 577 ms
60,732 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Run {
    public static void main (String arg[]) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int[] X = new int[N];
        for (int i = 0; i < N; i++) {
            X[i] = scan.nextInt();
        }
        Arrays.sort(X);
        int min = X[1] - X[0];
        int tmp;
        for (int i = 1; i < N-1; i++) {
            tmp = X[i+1] - X[i];
            if ((min==0 && tmp!=0) || min > tmp) min = tmp;
        }
        System.out.println(min);
    }
}
0