結果

問題 No.135 とりあえず1次元の問題
ユーザー kou6839kou6839
提出日時 2015-01-30 22:57:35
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 464 bytes
コンパイル時間 2,361 ms
コンパイル使用メモリ 71,444 KB
実行使用メモリ 63,356 KB
最終ジャッジ日時 2023-08-31 02:09:40
合計ジャッジ時間 8,109 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 491 ms
60,732 KB
testcase_01 AC 104 ms
56,128 KB
testcase_02 WA -
testcase_03 AC 104 ms
55,980 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 138 ms
56,028 KB
testcase_13 AC 118 ms
56,756 KB
testcase_14 AC 164 ms
56,404 KB
testcase_15 AC 132 ms
56,224 KB
testcase_16 WA -
testcase_17 AC 160 ms
55,892 KB
testcase_18 AC 124 ms
55,972 KB
testcase_19 AC 158 ms
56,692 KB
testcase_20 AC 155 ms
54,784 KB
testcase_21 WA -
testcase_22 WA -
evil01.txt AC 488 ms
60,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] num = new int[n];
        for(int i=0;i<n;i++){
        	num[i]=sc.nextInt();
        }
        Arrays.sort(num);
        int ans=999999;
        for(int i=0;i<=n-2;i++){
        	ans=Math.min(ans, num[i+1]-num[i]);
        }
        System.out.println(ans);
    }
}			
0