結果
問題 | No.123 カードシャッフル |
ユーザー |
![]() |
提出日時 | 2016-05-03 12:55:06 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 626 bytes |
コンパイル時間 | 592 ms |
コンパイル使用メモリ | 72,712 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-05 03:28:33 |
合計ジャッジ時間 | 1,276 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 2 |
other | AC * 4 WA * 6 |
ソースコード
#include <algorithm>#include <iostream>#include <map>#include <numeric>#include <set>#include <sstream>#include <string>#include <vector>#include <cmath>#include <stack>using namespace std;int main() {int N,M;cin >> N >> M;int cards[51] = {0};int cards_s[51] = {0};for (int i = 0;i <=N;i++){cards[i] = i;}for (int i = 0;i < M;i++){int c;cin >> c;for (int j = 0;j <=N;j++){cards_s[j] = cards[j];}cards_s[1] = c;for (int j = 2;j<=c;j++){cards_s[j] = cards[j-1];}for (int j = 0;j <=N;j++){cards[j] = cards_s[j];}}cout << cards[1] << endl;return 0;}