結果

問題 No.123 カードシャッフル
ユーザー HimatsubushinHimatsubushin
提出日時 2022-12-22 16:28:10
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 10 ms / 5,000 ms
コード長 368 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 28,468 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-11 11:17:07
合計ジャッジ時間 1,893 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>

#define N 50

int main(int argc, const char * argv[]) {
  int card[N], n, m, a, temp;

  scanf("%d %d", &n, &m);

  for (a = 0; a < n; a++)
    card[a] = a + 1;

  for (; m > 0; m--) {
    scanf("%d", &a);
    temp = card[--a];
    for (; a > 0; a--)
      card[a] = card[a - 1];
    card[0] = temp;
  }

  printf("%d\n", card[0]);

  return 0;
}
0