結果

問題 No.361 門松ゲーム2
ユーザー takeya_okinotakeya_okino
提出日時 2017-07-17 18:22:41
言語 PHP
(8.3.4)
結果
AC  
実行時間 552 ms / 2,000 ms
コード長 621 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 31,080 KB
実行使用メモリ 31,344 KB
最終ジャッジ日時 2024-04-16 23:55:19
合計ジャッジ時間 4,822 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
31,024 KB
testcase_01 AC 41 ms
31,080 KB
testcase_02 AC 42 ms
30,836 KB
testcase_03 AC 42 ms
31,260 KB
testcase_04 AC 41 ms
31,148 KB
testcase_05 AC 41 ms
31,228 KB
testcase_06 AC 41 ms
30,976 KB
testcase_07 AC 40 ms
31,024 KB
testcase_08 AC 43 ms
31,052 KB
testcase_09 AC 43 ms
31,020 KB
testcase_10 AC 42 ms
31,048 KB
testcase_11 AC 41 ms
31,144 KB
testcase_12 AC 42 ms
30,984 KB
testcase_13 AC 42 ms
31,124 KB
testcase_14 AC 263 ms
31,136 KB
testcase_15 AC 56 ms
31,176 KB
testcase_16 AC 251 ms
31,344 KB
testcase_17 AC 192 ms
31,020 KB
testcase_18 AC 69 ms
31,312 KB
testcase_19 AC 192 ms
30,936 KB
testcase_20 AC 50 ms
30,964 KB
testcase_21 AC 238 ms
31,088 KB
testcase_22 AC 552 ms
31,256 KB
testcase_23 AC 217 ms
31,020 KB
testcase_24 AC 220 ms
31,068 KB
testcase_25 AC 223 ms
30,996 KB
testcase_26 AC 233 ms
31,252 KB
testcase_27 AC 239 ms
31,172 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$array = explode(" ", trim(fgets(STDIN)));
$L = $array[0];
$D = $array[1];
$grundy = array();
for($i = 1; $i < 6; $i++) {
  $grundy[$i] = 0;
}
for($i = 6; $i <= $L; $i++) {
  $grundy_array = array();
  for($x = 1; $x <= intdiv($i, 3); $x++) {
    for($y = $x + 1; 2 * $y < $i - $x; $y++) {
      if(2 * $x + $y >= $i - $D) {
        $grundy_array[] = $grundy[$x] ^ $grundy[$y] ^ $grundy[$i - $x - $y];
      }
    }
  }
  for($j = 0; $j <= 1000000000; $j++) {
    if(!in_array($j, $grundy_array)) {
      $grundy[$i] = $j;
      break;
    }
  }
}
$ans = 'kado';
if($grundy[$L] == 0) $ans = 'matsu';
print($ans);
?>
0