結果

問題 No.716 距離
ユーザー yui556yui556
提出日時 2018-08-24 16:41:32
言語 Java21
(openjdk 21)
結果
AC  
実行時間 209 ms / 2,000 ms
コード長 592 bytes
コンパイル時間 3,551 ms
コンパイル使用メモリ 72,164 KB
実行使用メモリ 58,268 KB
最終ジャッジ日時 2023-09-04 13:20:57
合計ジャッジ時間 12,989 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 207 ms
56,156 KB
testcase_01 AC 202 ms
56,596 KB
testcase_02 AC 206 ms
56,828 KB
testcase_03 AC 205 ms
56,852 KB
testcase_04 AC 207 ms
56,656 KB
testcase_05 AC 207 ms
56,604 KB
testcase_06 AC 207 ms
56,708 KB
testcase_07 AC 132 ms
55,828 KB
testcase_08 AC 129 ms
55,468 KB
testcase_09 AC 131 ms
55,752 KB
testcase_10 AC 203 ms
56,564 KB
testcase_11 AC 182 ms
56,032 KB
testcase_12 AC 200 ms
57,048 KB
testcase_13 AC 202 ms
56,388 KB
testcase_14 AC 129 ms
55,648 KB
testcase_15 AC 202 ms
56,672 KB
testcase_16 AC 201 ms
56,688 KB
testcase_17 AC 209 ms
56,788 KB
testcase_18 AC 143 ms
55,512 KB
testcase_19 AC 173 ms
55,684 KB
testcase_20 AC 133 ms
56,068 KB
testcase_21 AC 146 ms
55,516 KB
testcase_22 AC 159 ms
56,152 KB
testcase_23 AC 141 ms
55,788 KB
testcase_24 AC 201 ms
56,312 KB
testcase_25 AC 166 ms
56,028 KB
testcase_26 AC 197 ms
56,280 KB
testcase_27 AC 205 ms
56,060 KB
testcase_28 AC 142 ms
55,552 KB
testcase_29 AC 200 ms
56,636 KB
testcase_30 AC 200 ms
56,024 KB
testcase_31 AC 203 ms
56,700 KB
testcase_32 AC 204 ms
56,376 KB
testcase_33 AC 201 ms
58,268 KB
testcase_34 AC 200 ms
55,960 KB
testcase_35 AC 136 ms
56,024 KB
testcase_36 AC 150 ms
55,876 KB
testcase_37 AC 139 ms
55,896 KB
testcase_38 AC 164 ms
55,748 KB
testcase_39 AC 200 ms
56,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class N0_716 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		int[] aa = new int[N];
		for (int i = 0; i < N; i++) {
			aa[i] = sc.nextInt();
		}
		Arrays.sort(aa);
		int max = 0;
		int min = aa[1] - aa[0];

		for(int i = 0; i < aa.length; i++)
			for(int y = i+1; y < aa.length; y++) {
				if(aa[y] - aa[i] > max)
					max = aa[y] - aa[i];
				else if(aa[y] - aa[i] < min)
					min = aa[y] - aa[i];
			}

		System.out.println(min);
		System.out.println(max);

	}

}
0