結果

問題 No.2 素因数ゲーム
ユーザー 鶴田浩之鶴田浩之
提出日時 2020-04-14 15:25:37
言語 PHP
(8.3.4)
結果
RE  
実行時間 -
コード長 748 bytes
コンパイル時間 1,890 ms
コンパイル使用メモリ 32,404 KB
実行使用メモリ 32,784 KB
最終ジャッジ日時 2024-04-09 05:24:35
合計ジャッジ時間 3,900 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

<?php

$N = trim(fgets(STDIN));
// 2<= $N <= 100000000
for ($i = 2; $i*$i <= $N; $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