結果

問題 No.123 カードシャッフル
ユーザー alpha_virginisalpha_virginis
提出日時 2015-03-06 23:23:54
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 21 ms / 5,000 ms
コード長 552 bytes
コンパイル時間 733 ms
コンパイル使用メモリ 68,848 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 15:30:44
合計ジャッジ時間 1,500 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 16 ms
4,376 KB
testcase_11 AC 21 ms
4,376 KB
testcase_12 AC 21 ms
4,380 KB
testcase_13 AC 20 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <math.h>

#include <iostream>
#include <vector>
#include <list>
#include <algorithm>

int main() {

  long i, j;
  long n, m;

  long num[64];

  std::vector<long> v;
  long temp;

  std::cin >> n >> m;
  for(i = 0; i < m; i++) {
    std::cin >> temp;
    v.push_back(temp);
  }

  for(i = 1; i <= n; i++) {
    num[i] = i;
  }

  for(i = 0; i < m; i++) {
    temp = v[i];
    num[0] = num[temp];
    for(j = temp-1; j >= 0; j--) {
      num[j+1] = num[j];
    }
  }

  std::cout << num[1] << std::endl;  
  
  return 0;
}

0