結果

問題 No.2 素因数ゲーム
ユーザー gahougahou
提出日時 2016-11-11 16:12:22
言語 Python2
(2.7.18)
結果
AC  
実行時間 19 ms / 5,000 ms
コード長 667 bytes
コンパイル時間 52 ms
コンパイル使用メモリ 6,624 KB
実行使用メモリ 6,080 KB
最終ジャッジ日時 2023-08-27 04:37:08
合計ジャッジ時間 1,895 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
6,024 KB
testcase_01 AC 19 ms
6,024 KB
testcase_02 AC 18 ms
5,956 KB
testcase_03 AC 18 ms
6,024 KB
testcase_04 AC 17 ms
5,832 KB
testcase_05 AC 19 ms
5,924 KB
testcase_06 AC 18 ms
5,848 KB
testcase_07 AC 17 ms
5,956 KB
testcase_08 AC 18 ms
5,908 KB
testcase_09 AC 18 ms
5,944 KB
testcase_10 AC 18 ms
5,832 KB
testcase_11 AC 18 ms
5,960 KB
testcase_12 AC 18 ms
5,948 KB
testcase_13 AC 18 ms
6,024 KB
testcase_14 AC 18 ms
6,024 KB
testcase_15 AC 18 ms
6,052 KB
testcase_16 AC 18 ms
6,080 KB
testcase_17 AC 18 ms
5,916 KB
testcase_18 AC 18 ms
5,936 KB
testcase_19 AC 18 ms
5,836 KB
testcase_20 AC 18 ms
5,912 KB
testcase_21 AC 18 ms
5,916 KB
testcase_22 AC 18 ms
6,016 KB
testcase_23 AC 18 ms
5,920 KB
testcase_24 AC 18 ms
5,960 KB
testcase_25 AC 18 ms
5,956 KB
testcase_26 AC 18 ms
5,920 KB
testcase_27 AC 18 ms
5,916 KB
testcase_28 AC 18 ms
5,940 KB
testcase_29 AC 18 ms
5,892 KB
testcase_30 AC 18 ms
6,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import re

def isPrime(n,lst):
  for i in xrange(len(lst)):
    if n%lst[i]==0: return False
    if n<=lst[i]**2: return True

def primes():
  lst=[2]
  n=3
  while True:
    if n > 10**4: break
    if isPrime(n,lst):
      lst.append(n)
    n+=2
  return lst

def breakDown(n):
  lst=primes()
  dic={}
  for i in xrange(len(lst)):
    c=0
    if not n%lst[i]==0: continue
    while True:
      if not n%lst[i]==0: break
      else:
        n/=lst[i]
        c+=1
    dic[lst[i]]=c
  if not n==1: dic[n]=1
  return dic

def judge(n):
  if n==0: print "Bob"
  else: print "Alice"

n=int(raw_input())
ans=0
dic=breakDown(n)
for i in dic.values():
  ans=ans^i
judge(ans)
0