結果

問題 No.135 とりあえず1次元の問題
ユーザー tsunatama5tsunatama5
提出日時 2015-02-04 20:07:49
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 694 bytes
コンパイル時間 3,133 ms
コンパイル使用メモリ 72,076 KB
実行使用メモリ 68,160 KB
最終ジャッジ日時 2023-09-01 02:54:06
合計ジャッジ時間 9,021 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 465 ms
66,776 KB
testcase_01 AC 114 ms
55,844 KB
testcase_02 AC 115 ms
54,660 KB
testcase_03 WA -
testcase_04 AC 118 ms
55,608 KB
testcase_05 AC 117 ms
56,716 KB
testcase_06 AC 116 ms
56,416 KB
testcase_07 AC 118 ms
56,276 KB
testcase_08 AC 118 ms
56,052 KB
testcase_09 AC 116 ms
55,972 KB
testcase_10 AC 118 ms
55,788 KB
testcase_11 AC 116 ms
56,256 KB
testcase_12 AC 128 ms
56,112 KB
testcase_13 AC 117 ms
56,108 KB
testcase_14 AC 150 ms
56,244 KB
testcase_15 AC 126 ms
56,476 KB
testcase_16 AC 151 ms
56,488 KB
testcase_17 AC 152 ms
56,120 KB
testcase_18 AC 118 ms
55,856 KB
testcase_19 AC 143 ms
56,168 KB
testcase_20 AC 130 ms
56,260 KB
testcase_21 AC 404 ms
68,160 KB
testcase_22 AC 442 ms
66,400 KB
evil01.txt AC 467 ms
67,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package P135;

import java.io.*;
import java.util.Arrays;
import java.util.Scanner;

public class P135 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = sc.nextLine();
		int nint = Integer.parseInt(n);
		String l = sc.nextLine();
		String[] lstrs = l.split(" ");

		int lint[] = new int[nint];
		int i = 0;
		int max = nint - 1;
		
		for (i=0;i<=max;i++) {
			lint[i] = Integer.parseInt(lstrs[i]);
		}
		
		int j;
		int temp = 0;
		int ans = 1000000;
		
		Arrays.sort(lint);
		
		for (i=1;i<=max;i++) {
			temp = Math.abs(lint[i-1] - lint[i]);
			if (ans > temp && lint[i] != lint[i-1]) {
				ans = temp;
			}
		}
		System.out.println(ans);
	}
}

0