結果

問題 No.2 素因数ゲーム
ユーザー hotpepsihotpepsi
提出日時 2014-12-23 01:27:50
言語 Python2
(2.7.18)
結果
AC  
実行時間 31 ms / 5,000 ms
コード長 399 bytes
コンパイル時間 1,314 ms
コンパイル使用メモリ 6,732 KB
実行使用メモリ 6,180 KB
最終ジャッジ日時 2023-08-27 03:37:40
合計ジャッジ時間 2,404 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
5,956 KB
testcase_01 AC 31 ms
5,988 KB
testcase_02 AC 31 ms
6,100 KB
testcase_03 AC 30 ms
6,096 KB
testcase_04 AC 30 ms
6,036 KB
testcase_05 AC 30 ms
6,144 KB
testcase_06 AC 31 ms
6,096 KB
testcase_07 AC 30 ms
6,144 KB
testcase_08 AC 30 ms
6,060 KB
testcase_09 AC 30 ms
5,992 KB
testcase_10 AC 30 ms
6,036 KB
testcase_11 AC 30 ms
6,028 KB
testcase_12 AC 30 ms
6,040 KB
testcase_13 AC 30 ms
5,960 KB
testcase_14 AC 30 ms
6,180 KB
testcase_15 AC 30 ms
6,040 KB
testcase_16 AC 30 ms
5,992 KB
testcase_17 AC 30 ms
6,056 KB
testcase_18 AC 30 ms
5,964 KB
testcase_19 AC 30 ms
6,036 KB
testcase_20 AC 30 ms
6,040 KB
testcase_21 AC 30 ms
5,956 KB
testcase_22 AC 31 ms
6,040 KB
testcase_23 AC 30 ms
5,952 KB
testcase_24 AC 30 ms
5,988 KB
testcase_25 AC 31 ms
5,952 KB
testcase_26 AC 30 ms
6,036 KB
testcase_27 AC 30 ms
6,040 KB
testcase_28 AC 30 ms
6,036 KB
testcase_29 AC 30 ms
5,956 KB
testcase_30 AC 30 ms
6,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

primes = [2]

def isprime(n):
  for p in primes:
    if p * p > n:
      return 1
    if (n % p) == 0:
      return 0
  return 1

n = 3
while n < 32000:
  if isprime(n):
    primes.append(n)
  n += 2

N = int(sys.stdin.readline())
ans = 0
for n in primes:
  a = 0
  while (N % n) == 0:
    N /= n
    a += 1
  ans ^= a
if N > 1:
  ans ^= 1

if ans:
  print("Alice")
else:
  print("Bob")
0