結果

問題 No.365 ジェンガソート
ユーザー YamaKasaYamaKasa
提出日時 2018-09-18 23:07:33
言語 Java21
(openjdk 21)
結果
AC  
実行時間 541 ms / 2,000 ms
コード長 412 bytes
コンパイル時間 1,982 ms
コンパイル使用メモリ 71,172 KB
実行使用メモリ 61,444 KB
最終ジャッジ日時 2023-09-25 09:58:30
合計ジャッジ時間 17,485 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,852 KB
testcase_01 AC 124 ms
55,504 KB
testcase_02 AC 126 ms
55,836 KB
testcase_03 AC 127 ms
56,140 KB
testcase_04 AC 125 ms
56,128 KB
testcase_05 AC 126 ms
55,920 KB
testcase_06 AC 126 ms
55,972 KB
testcase_07 AC 123 ms
56,000 KB
testcase_08 AC 124 ms
55,852 KB
testcase_09 AC 124 ms
55,840 KB
testcase_10 AC 124 ms
56,084 KB
testcase_11 AC 123 ms
55,784 KB
testcase_12 AC 126 ms
55,808 KB
testcase_13 AC 130 ms
55,844 KB
testcase_14 AC 124 ms
55,512 KB
testcase_15 AC 134 ms
55,548 KB
testcase_16 AC 496 ms
60,324 KB
testcase_17 AC 496 ms
60,256 KB
testcase_18 AC 234 ms
59,020 KB
testcase_19 AC 541 ms
61,444 KB
testcase_20 AC 356 ms
60,268 KB
testcase_21 AC 322 ms
60,276 KB
testcase_22 AC 463 ms
60,176 KB
testcase_23 AC 386 ms
60,200 KB
testcase_24 AC 464 ms
60,032 KB
testcase_25 AC 300 ms
60,272 KB
testcase_26 AC 439 ms
60,124 KB
testcase_27 AC 541 ms
60,668 KB
testcase_28 AC 444 ms
60,652 KB
testcase_29 AC 525 ms
60,392 KB
testcase_30 AC 449 ms
60,500 KB
testcase_31 AC 333 ms
60,248 KB
testcase_32 AC 332 ms
60,460 KB
testcase_33 AC 501 ms
60,364 KB
testcase_34 AC 282 ms
60,728 KB
testcase_35 AC 476 ms
60,208 KB
testcase_36 AC 514 ms
60,160 KB
testcase_37 AC 505 ms
60,532 KB
testcase_38 AC 500 ms
60,720 KB
testcase_39 AC 535 ms
60,916 KB
testcase_40 AC 508 ms
60,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int []a = new int[N];
		for(int i = 0; i < N; i++) {
			a[i] = scan.nextInt();
		}
		scan.close();
		int k = N;
		int cnt = 0;
		for(int i = N - 1; i >= 0; i--) {
			if(a[i] == k) {
				k--;
			}else {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
}
0