結果

問題 No.2335 Jump
ユーザー ks2mks2m
提出日時 2023-06-02 21:44:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 255 ms / 2,000 ms
コード長 612 bytes
コンパイル時間 4,262 ms
コンパイル使用メモリ 73,064 KB
実行使用メモリ 66,836 KB
最終ジャッジ日時 2023-08-28 03:04:08
合計ジャッジ時間 7,223 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,324 KB
testcase_01 AC 44 ms
49,220 KB
testcase_02 AC 45 ms
49,328 KB
testcase_03 AC 45 ms
49,324 KB
testcase_04 AC 44 ms
49,292 KB
testcase_05 AC 44 ms
49,256 KB
testcase_06 AC 44 ms
49,708 KB
testcase_07 AC 53 ms
49,428 KB
testcase_08 AC 52 ms
47,416 KB
testcase_09 AC 52 ms
49,524 KB
testcase_10 AC 53 ms
49,344 KB
testcase_11 AC 54 ms
49,520 KB
testcase_12 AC 208 ms
60,720 KB
testcase_13 AC 213 ms
59,624 KB
testcase_14 AC 205 ms
60,712 KB
testcase_15 AC 214 ms
60,364 KB
testcase_16 AC 211 ms
60,720 KB
testcase_17 AC 251 ms
66,836 KB
testcase_18 AC 202 ms
60,792 KB
testcase_19 AC 217 ms
61,084 KB
testcase_20 AC 255 ms
64,380 KB
testcase_21 AC 208 ms
58,196 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		sa = br.readLine().split(" ");
		int[] a = new int[n];
		Set<Integer> set = new HashSet<>();
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sa[i]);
			if (a[i] <= n) {
				set.add(a[i]);
			}
		}
		br.close();

		System.out.println(a[n - 1] - n);
	}
}
0