結果

問題 No.135 とりあえず1次元の問題
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-12 07:48:45
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 606 bytes
コンパイル時間 2,308 ms
コンパイル使用メモリ 71,364 KB
実行使用メモリ 62,764 KB
最終ジャッジ日時 2023-09-02 00:42:02
合計ジャッジ時間 8,414 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 544 ms
60,700 KB
testcase_01 AC 121 ms
55,516 KB
testcase_02 WA -
testcase_03 AC 120 ms
56,080 KB
testcase_04 AC 128 ms
56,488 KB
testcase_05 AC 127 ms
55,744 KB
testcase_06 AC 129 ms
56,860 KB
testcase_07 AC 127 ms
55,892 KB
testcase_08 AC 130 ms
56,608 KB
testcase_09 AC 129 ms
55,880 KB
testcase_10 AC 129 ms
55,556 KB
testcase_11 AC 130 ms
55,812 KB
testcase_12 AC 148 ms
55,796 KB
testcase_13 AC 131 ms
55,856 KB
testcase_14 AC 175 ms
56,360 KB
testcase_15 AC 149 ms
55,908 KB
testcase_16 AC 174 ms
56,320 KB
testcase_17 AC 176 ms
56,692 KB
testcase_18 AC 134 ms
56,220 KB
testcase_19 AC 164 ms
56,708 KB
testcase_20 AC 170 ms
56,272 KB
testcase_21 WA -
testcase_22 AC 551 ms
60,604 KB
evil01.txt AC 557 ms
60,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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 min = X[N-1];
        for(int i=1; i<N; i++){
            int temp = X[i]-X[i-1];
            if(temp!=0 && min>temp){
                min = temp;
            }
        }
        if( min!=X[N-1] ){
            System.out.println(min);
        }else{
            System.out.println(0);
        }
    }
}
0