結果

問題 No.2 素因数ゲーム
ユーザー hotpepsihotpepsi
提出日時 2014-12-23 01:27:50
言語 Python2
(2.7.18)
結果
AC  
実行時間 33 ms / 5,000 ms
コード長 399 bytes
コンパイル時間 405 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2024-12-26 10:53:03
合計ジャッジ時間 2,424 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

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