結果
| 問題 | No.123 カードシャッフル |
| コンテスト | |
| ユーザー |
fkwnw3_1243
|
| 提出日時 | 2017-04-29 09:25:37 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 801 bytes |
| 記録 | |
| コンパイル時間 | 1,607 ms |
| コンパイル使用メモリ | 82,456 KB |
| 実行使用メモリ | 50,644 KB |
| 最終ジャッジ日時 | 2026-04-04 07:13:31 |
| 合計ジャッジ時間 | 2,889 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 6 WA * 4 |
ソースコード
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);
}
}
fkwnw3_1243