結果

問題 No.135 とりあえず1次元の問題
ユーザー 練習生練習生
提出日時 2015-08-19 14:15:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 597 ms / 5,000 ms
コード長 732 bytes
コンパイル時間 3,545 ms
コンパイル使用メモリ 74,192 KB
実行使用メモリ 63,756 KB
最終ジャッジ日時 2023-09-01 21:32:13
合計ジャッジ時間 10,278 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 587 ms
63,464 KB
testcase_01 AC 123 ms
57,884 KB
testcase_02 AC 121 ms
57,632 KB
testcase_03 AC 123 ms
57,920 KB
testcase_04 AC 132 ms
57,872 KB
testcase_05 AC 131 ms
57,640 KB
testcase_06 AC 131 ms
57,912 KB
testcase_07 AC 134 ms
58,084 KB
testcase_08 AC 134 ms
58,032 KB
testcase_09 AC 132 ms
57,944 KB
testcase_10 AC 131 ms
57,900 KB
testcase_11 AC 131 ms
58,192 KB
testcase_12 AC 152 ms
58,276 KB
testcase_13 AC 134 ms
57,932 KB
testcase_14 AC 199 ms
59,104 KB
testcase_15 AC 155 ms
58,112 KB
testcase_16 AC 200 ms
58,436 KB
testcase_17 AC 198 ms
58,956 KB
testcase_18 AC 140 ms
58,040 KB
testcase_19 AC 194 ms
58,692 KB
testcase_20 AC 199 ms
59,056 KB
testcase_21 AC 558 ms
62,984 KB
testcase_22 AC 597 ms
63,756 KB
evil01.txt AC 573 ms
62,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;
public class Copy_2_of_No135 implements Runnable {
	public static void main(String[] args) {
		new Thread(null, new Copy_2_of_No135(), "", 512 * 1024 * 1024).start();
		}
		public void run() {
			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();
			}
			sc.close();
			// 地点を昇順にソート
			Arrays.sort(x);
			int min = 9999999;
			for(int i = 0; i < (n - 1); i++){
				if((x[i] != x[i + 1]) && (x[i + 1] - x[i]) < min){
					min = x[i + 1] - x[i];
				}
			}
			if(min == 9999999){
				min = 0;
			}

			System.out.println(min);
		}	
}
0