結果
問題 | No.123 カードシャッフル |
ユーザー |
![]() |
提出日時 | 2017-01-21 23:00:08 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 35 ms / 5,000 ms |
コード長 | 532 bytes |
コンパイル時間 | 595 ms |
コンパイル使用メモリ | 67,528 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 05:16:15 |
合計ジャッジ時間 | 1,421 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 |
ソースコード
#include <iostream>#include <list>using namespace std;int main(){int N, M;cin >> N >> M;list<int> lst;for (int i = 0; i < N; i++) {lst.push_back(i + 1);}for (int i = 0; i < M; i++) {int c, n = 0;cin >> c;for (auto it = lst.begin(); it != lst.end(); ++it) {int num = *it;if (++n == c) {lst.erase(it);lst.push_front(num);}}}cout << *lst.begin() << endl;return 0;}