結果

問題 No.39 桁の数字を入れ替え
ユーザー HimatsubushinHimatsubushin
提出日時 2022-12-23 08:03:26
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 436 bytes
コンパイル時間 963 ms
コンパイル使用メモリ 61,060 KB
実行使用メモリ 12,048 KB
最終ジャッジ日時 2023-08-11 11:46:59
合計ジャッジ時間 8,991 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>

using namespace std;

int main(int argc, const char * argv[]) {
  vector<int> card;
  int n, k, i, temp;

  cout << "N K = ";
  cin >> n >> k;

  for (i = 0; i < n; i++)
    card.push_back(i + 1);
  
  for (; k > 0; k--) {
    cout << "i = ";
    cin >> i;
    temp = card[--i];
    card.erase(card.begin() + i);
    card.insert(card.begin(), temp);
  }

  cout << card[0] << endl;

  return 0;
}
0