結果

問題 No.365 ジェンガソート
ユーザー bambambambam
提出日時 2019-08-27 13:38:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 615 ms / 2,000 ms
コード長 421 bytes
コンパイル時間 2,048 ms
コンパイル使用メモリ 74,852 KB
実行使用メモリ 48,632 KB
最終ジャッジ日時 2024-04-26 22:25:12
合計ジャッジ時間 17,595 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
41,140 KB
testcase_01 AC 113 ms
40,076 KB
testcase_02 AC 117 ms
40,516 KB
testcase_03 AC 113 ms
40,008 KB
testcase_04 AC 126 ms
41,156 KB
testcase_05 AC 126 ms
41,448 KB
testcase_06 AC 114 ms
40,020 KB
testcase_07 AC 114 ms
40,396 KB
testcase_08 AC 126 ms
41,232 KB
testcase_09 AC 114 ms
40,156 KB
testcase_10 AC 114 ms
39,852 KB
testcase_11 AC 126 ms
40,908 KB
testcase_12 AC 128 ms
41,092 KB
testcase_13 AC 118 ms
39,924 KB
testcase_14 AC 127 ms
41,256 KB
testcase_15 AC 132 ms
41,068 KB
testcase_16 AC 549 ms
48,416 KB
testcase_17 AC 489 ms
46,740 KB
testcase_18 AC 240 ms
46,504 KB
testcase_19 AC 588 ms
48,500 KB
testcase_20 AC 351 ms
47,612 KB
testcase_21 AC 344 ms
47,648 KB
testcase_22 AC 518 ms
48,344 KB
testcase_23 AC 436 ms
48,220 KB
testcase_24 AC 560 ms
48,332 KB
testcase_25 AC 322 ms
47,812 KB
testcase_26 AC 434 ms
46,904 KB
testcase_27 AC 584 ms
48,552 KB
testcase_28 AC 475 ms
48,224 KB
testcase_29 AC 567 ms
48,268 KB
testcase_30 AC 519 ms
48,064 KB
testcase_31 AC 380 ms
47,700 KB
testcase_32 AC 372 ms
47,732 KB
testcase_33 AC 615 ms
48,328 KB
testcase_34 AC 306 ms
46,504 KB
testcase_35 AC 549 ms
48,208 KB
testcase_36 AC 528 ms
48,040 KB
testcase_37 AC 506 ms
47,180 KB
testcase_38 AC 598 ms
48,520 KB
testcase_39 AC 556 ms
48,632 KB
testcase_40 AC 549 ms
47,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

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