結果

問題 No.135 とりあえず1次元の問題
ユーザー キョウチクキョウチク
提出日時 2019-09-20 03:49:37
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 762 bytes
コンパイル時間 3,670 ms
コンパイル使用メモリ 72,764 KB
実行使用メモリ 61,460 KB
最終ジャッジ日時 2023-10-11 12:36:27
合計ジャッジ時間 7,441 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 243 ms
61,132 KB
testcase_01 AC 43 ms
49,296 KB
testcase_02 AC 42 ms
49,540 KB
testcase_03 WA -
testcase_04 AC 44 ms
49,180 KB
testcase_05 AC 44 ms
49,596 KB
testcase_06 AC 44 ms
49,852 KB
testcase_07 AC 44 ms
49,324 KB
testcase_08 AC 43 ms
49,416 KB
testcase_09 AC 43 ms
49,424 KB
testcase_10 AC 44 ms
49,152 KB
testcase_11 AC 45 ms
49,148 KB
testcase_12 AC 46 ms
49,328 KB
testcase_13 AC 45 ms
49,420 KB
testcase_14 AC 51 ms
49,536 KB
testcase_15 AC 46 ms
49,236 KB
testcase_16 AC 51 ms
49,172 KB
testcase_17 AC 51 ms
49,340 KB
testcase_18 AC 45 ms
49,232 KB
testcase_19 AC 49 ms
49,524 KB
testcase_20 AC 47 ms
49,512 KB
testcase_21 AC 209 ms
60,852 KB
testcase_22 AC 247 ms
61,460 KB
evil01.txt AC 244 ms
61,500 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 && X[i-1]!=X[i]) {
        		min=Math.abs(X[i-1]-X[i]);
        	}
        }
        System.out.println(min);
    }
}
0