結果

問題 No.39 桁の数字を入れ替え
ユーザー Himatsubushin
提出日時 2022-12-23 08:03:26
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 436 bytes
コンパイル時間 604 ms
コンパイル使用メモリ 61,280 KB
実行使用メモリ 817,488 KB
最終ジャッジ日時 2024-11-18 03:56:52
合計ジャッジ時間 5,608 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 17 MLE * 2
権限があれば一括ダウンロードができます

ソースコード

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