結果

問題 No.123 カードシャッフル
ユーザー takeya_okinotakeya_okino
提出日時 2017-07-14 12:17:36
言語 PHP
(8.3.4)
結果
WA  
実行時間 -
コード長 330 bytes
コンパイル時間 123 ms
コンパイル使用メモリ 31,888 KB
実行使用メモリ 36,532 KB
最終ジャッジ日時 2024-04-16 19:25:40
合計ジャッジ時間 1,473 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
30,960 KB
testcase_01 WA -
testcase_02 AC 41 ms
31,012 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 40 ms
30,776 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 41 ms
30,868 KB
testcase_09 WA -
testcase_10 AC 55 ms
33,420 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 58 ms
35,856 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$array = explode(" ", trim(fgets(STDIN)));
$N = $array[0];
$M = $array[1];
$A = explode(" ", trim(fgets(STDIN)));
$card = array();
for($i = 0; $i < $N; $i++) {
  $card[$i] = $i + 1;
}
for($i = 0; $i < $M; $i++) {
  $index = $A[$i] - 1;
  $c = $card[0];
  $card[0] = $card[$index];
  $card[$index] = $c;
}
print($card[0]);
?>
0