結果

問題 No.716 距離
ユーザー 37zigen37zigen
提出日時 2018-07-27 22:40:00
言語 Java21
(openjdk 21)
結果
AC  
実行時間 236 ms / 2,000 ms
コード長 594 bytes
コンパイル時間 2,685 ms
コンパイル使用メモリ 71,028 KB
実行使用メモリ 58,236 KB
最終ジャッジ日時 2023-09-18 11:48:14
合計ジャッジ時間 11,606 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 236 ms
56,764 KB
testcase_01 AC 218 ms
56,544 KB
testcase_02 AC 229 ms
56,572 KB
testcase_03 AC 216 ms
56,704 KB
testcase_04 AC 218 ms
56,680 KB
testcase_05 AC 227 ms
56,868 KB
testcase_06 AC 224 ms
56,656 KB
testcase_07 AC 126 ms
56,008 KB
testcase_08 AC 126 ms
56,096 KB
testcase_09 AC 128 ms
56,000 KB
testcase_10 AC 222 ms
57,092 KB
testcase_11 AC 175 ms
55,720 KB
testcase_12 AC 210 ms
58,236 KB
testcase_13 AC 229 ms
56,768 KB
testcase_14 AC 126 ms
55,620 KB
testcase_15 AC 223 ms
56,688 KB
testcase_16 AC 217 ms
56,852 KB
testcase_17 AC 229 ms
56,468 KB
testcase_18 AC 143 ms
55,832 KB
testcase_19 AC 176 ms
57,092 KB
testcase_20 AC 130 ms
55,780 KB
testcase_21 AC 146 ms
56,308 KB
testcase_22 AC 165 ms
56,228 KB
testcase_23 AC 141 ms
55,784 KB
testcase_24 AC 221 ms
55,056 KB
testcase_25 AC 194 ms
56,452 KB
testcase_26 AC 216 ms
56,788 KB
testcase_27 AC 219 ms
56,784 KB
testcase_28 AC 141 ms
55,772 KB
testcase_29 AC 219 ms
56,636 KB
testcase_30 AC 220 ms
56,676 KB
testcase_31 AC 215 ms
56,920 KB
testcase_32 AC 221 ms
56,664 KB
testcase_33 AC 210 ms
56,784 KB
testcase_34 AC 211 ms
57,052 KB
testcase_35 AC 131 ms
55,784 KB
testcase_36 AC 154 ms
55,728 KB
testcase_37 AC 136 ms
55,592 KB
testcase_38 AC 174 ms
56,000 KB
testcase_39 AC 223 ms
56,452 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] a = new int[N];
		for (int i = 0; i < N; ++i) {
			a[i] = sc.nextInt();
		}
		long min = Long.MAX_VALUE / 3, max = -Long.MAX_VALUE / 3;
		for (int i = 0; i < N; ++i) {
			for (int j = 0; j < N; ++j) {
				if (i == j)
					continue;
				min = Math.min(min, Math.abs(a[i] - a[j]));
				max = Math.max(max, Math.abs(a[i] - a[j]));
			}
		}
		System.out.println(min);
		System.out.println(max);
	}
}
0