結果

問題 No.123 カードシャッフル
ユーザー fkwnw3_1243fkwnw3_1243
提出日時 2017-04-29 09:25:37
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 801 bytes
コンパイル時間 1,930 ms
コンパイル使用メモリ 72,360 KB
実行使用メモリ 61,240 KB
最終ジャッジ日時 2023-10-11 20:17:53
合計ジャッジ時間 3,928 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
48,976 KB
testcase_01 AC 43 ms
49,180 KB
testcase_02 AC 43 ms
49,696 KB
testcase_03 AC 43 ms
49,472 KB
testcase_04 AC 43 ms
49,400 KB
testcase_05 AC 42 ms
47,372 KB
testcase_06 WA -
testcase_07 AC 43 ms
49,224 KB
testcase_08 AC 42 ms
49,296 KB
testcase_09 AC 44 ms
49,304 KB
testcase_10 AC 154 ms
58,572 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

import static java.lang.System.in;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        String[] inputs = reader.readLine().split(" ");
        int N = Integer.parseInt(inputs[0]);
        int M = Integer.parseInt(inputs[1]);
        inputs = reader.readLine().split(" ");
        int top = 1;
        for (int i = M - 1; i > -1; i--) {
            int a = Integer.parseInt(inputs[i]);
            if (top == 1) {
                top = a;
            } else if (top < a) {
                top -= 1;
            }
        }
        System.out.println(top);
    }
}
0