結果
| 問題 |
No.123 カードシャッフル
|
| コンテスト | |
| ユーザー |
fkwnw3_1243
|
| 提出日時 | 2017-04-29 09:25:37 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 801 bytes |
| コンパイル時間 | 2,813 ms |
| コンパイル使用メモリ | 74,416 KB |
| 実行使用メモリ | 60,956 KB |
| 最終ジャッジ日時 | 2024-09-13 19:09:07 |
| 合計ジャッジ時間 | 4,443 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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