結果

問題 No.365 ジェンガソート
ユーザー tentententen
提出日時 2020-10-03 11:21:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 547 ms / 2,000 ms
コード長 416 bytes
コンパイル時間 2,315 ms
コンパイル使用メモリ 71,676 KB
実行使用メモリ 61,408 KB
最終ジャッジ日時 2023-09-25 04:58:28
合計ジャッジ時間 18,097 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,728 KB
testcase_01 AC 118 ms
55,816 KB
testcase_02 AC 122 ms
55,792 KB
testcase_03 AC 120 ms
55,800 KB
testcase_04 AC 118 ms
55,784 KB
testcase_05 AC 122 ms
55,792 KB
testcase_06 AC 119 ms
56,060 KB
testcase_07 AC 119 ms
55,872 KB
testcase_08 AC 122 ms
56,016 KB
testcase_09 AC 121 ms
56,128 KB
testcase_10 AC 119 ms
55,884 KB
testcase_11 AC 122 ms
55,960 KB
testcase_12 AC 131 ms
55,536 KB
testcase_13 AC 127 ms
55,976 KB
testcase_14 AC 121 ms
55,680 KB
testcase_15 AC 128 ms
55,676 KB
testcase_16 AC 504 ms
60,544 KB
testcase_17 AC 499 ms
60,208 KB
testcase_18 AC 233 ms
59,532 KB
testcase_19 AC 547 ms
61,104 KB
testcase_20 AC 348 ms
60,700 KB
testcase_21 AC 307 ms
60,076 KB
testcase_22 AC 459 ms
60,140 KB
testcase_23 AC 387 ms
60,536 KB
testcase_24 AC 455 ms
60,612 KB
testcase_25 AC 298 ms
60,300 KB
testcase_26 AC 477 ms
61,408 KB
testcase_27 AC 531 ms
60,480 KB
testcase_28 AC 411 ms
60,252 KB
testcase_29 AC 513 ms
60,748 KB
testcase_30 AC 448 ms
60,388 KB
testcase_31 AC 318 ms
60,348 KB
testcase_32 AC 334 ms
60,108 KB
testcase_33 AC 507 ms
60,952 KB
testcase_34 AC 276 ms
60,496 KB
testcase_35 AC 469 ms
60,228 KB
testcase_36 AC 501 ms
60,168 KB
testcase_37 AC 515 ms
60,700 KB
testcase_38 AC 502 ms
60,740 KB
testcase_39 AC 541 ms
61,152 KB
testcase_40 AC 508 ms
60,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
		    arr[i] = sc.nextInt();
		}
		int count = n;
		int num = n;
		for (int i = n - 1; i >= 0; i--) {
		    if (arr[i] == num) {
		        count--;
		        num--;
		    }
		}
		System.out.println(count);
	}
}
0