結果
問題 |
No.123 カードシャッフル
|
ユーザー |
![]() |
提出日時 | 2016-02-29 17:59:42 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 19 ms / 5,000 ms |
コード長 | 284 bytes |
コンパイル時間 | 393 ms |
コンパイル使用メモリ | 55,416 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-24 12:49:15 |
合計ジャッジ時間 | 1,195 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 |
ソースコード
#include <iostream> using namespace std; int main(){ int n,m; cin >> n >> m; int a[m]; for(int i = 0;i < m;i++) cin >> a[i]; int top = 1; for(int i = m - 1;i >= 0;i--){ if(top == 1) top = a[i]; else if(top <= a[i]) top--; } cout << top << endl; }