結果

問題 No.2 素因数ゲーム
ユーザー 鶴田浩之鶴田浩之
提出日時 2020-04-14 15:00:59
言語 PHP
(8.3.4)
結果
WA  
実行時間 -
コード長 747 bytes
コンパイル時間 1,509 ms
コンパイル使用メモリ 32,272 KB
実行使用メモリ 32,788 KB
最終ジャッジ日時 2024-04-09 05:22:57
合計ジャッジ時間 2,403 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 40 ms
32,528 KB
testcase_02 AC 40 ms
32,528 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 40 ms
32,532 KB
testcase_06 AC 39 ms
32,404 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 40 ms
32,400 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 40 ms
32,532 KB
testcase_15 AC 41 ms
32,528 KB
testcase_16 AC 42 ms
32,404 KB
testcase_17 AC 40 ms
32,404 KB
testcase_18 AC 39 ms
32,400 KB
testcase_19 RE -
testcase_20 WA -
testcase_21 RE -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 41 ms
32,532 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 40 ms
32,528 KB
testcase_30 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php

$N = trim(fgets(STDIN));
// 2<= $N <= 100000000
for ($i = 2; $i < 10000; $i++) {
  if (!($N % $i)) {
    $j = 0;
    while ($N % $i) {
      $N = $N/$i;
      $j++;
    }
    $arrays[] = $j;
  }
}

$one = 0;
foreach ($arrays as $array) {
  if ($array == 1) {
    $one++;
  }
}
$twomore = count($arrays) - $one;

if ($twomore % 2) {
  echo "Alice\n";
} else if ($twomore >= 4) {
  echo "Bob\n";
} else if ($twomore == 2) {
  if ($one % 2) {
    $x = 1;
  } else {
    $x = -1;
  }
  if ($arrays[0] == $arrays[1]) {
    $y = 1;
  } else {
    $y = -1;
  }
  if ($x * $y == -1) {
    echo "Bob\n";
  } else {
    echo "Alice\n";
  }
} else if ($twomore == 1) {
  if ($arrays[0] % 2) {
    echo "Alice\n";
  } else {
    echo "Bob\n";
  }
}

?>
0