結果

問題 No.123 カードシャッフル
ユーザー alpha_virginis
提出日時 2015-03-06 23:23:54
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 22 ms / 5,000 ms
コード長 552 bytes
コンパイル時間 561 ms
コンパイル使用メモリ 70,096 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-24 09:55:20
合計ジャッジ時間 1,415 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

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