結果

問題 No.135 とりあえず1次元の問題
ユーザー キョウチクキョウチク
提出日時 2019-09-20 03:47:32
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 746 bytes
コンパイル時間 4,118 ms
コンパイル使用メモリ 72,368 KB
実行使用メモリ 62,072 KB
最終ジャッジ日時 2023-10-11 12:33:32
合計ジャッジ時間 6,964 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 244 ms
61,116 KB
testcase_01 AC 43 ms
49,400 KB
testcase_02 WA -
testcase_03 AC 43 ms
49,896 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 47 ms
49,404 KB
testcase_13 AC 46 ms
49,636 KB
testcase_14 AC 51 ms
49,252 KB
testcase_15 AC 47 ms
49,316 KB
testcase_16 WA -
testcase_17 AC 51 ms
49,252 KB
testcase_18 AC 46 ms
49,292 KB
testcase_19 AC 51 ms
49,512 KB
testcase_20 AC 49 ms
49,492 KB
testcase_21 WA -
testcase_22 WA -
evil01.txt AC 257 ms
61,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Test{
    public static void main(String[] args) throws IOException{
        BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(buf.readLine());
        String[] s = buf.readLine().split(" ");
        int X[] = new int[N];
        X[0]=Integer.parseInt(s[0]);
        for(int i=1;i<N;i++) {
        	X[i]=Integer.parseInt(s[i]);
        }
        Arrays.sort(X);
        int min=1000000;
        for(int i=1;i<N;i++) {
        	if(Math.abs(X[i-1]-X[i])<min) {
        		min=Math.abs(X[i-1]-X[i]);
        	}
        }
        System.out.println(min);
    }
}
0