結果
問題 | No.123 カードシャッフル |
ユーザー |
![]() |
提出日時 | 2016-05-03 12:57:45 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 21 ms / 5,000 ms |
コード長 | 633 bytes |
コンパイル時間 | 665 ms |
コンパイル使用メモリ | 72,644 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-05 03:28:39 |
合計ジャッジ時間 | 1,348 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 |
ソースコード
#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] = cards[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;}