結果

問題 No.2 素因数ゲーム
ユーザー yaoshimaxyaoshimax
提出日時 2015-02-09 00:06:11
言語 Python2
(2.7.18)
結果
AC  
実行時間 18 ms / 5,000 ms
コード長 490 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 6,716 KB
実行使用メモリ 6,640 KB
最終ジャッジ日時 2023-08-27 03:39:04
合計ジャッジ時間 2,009 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
6,424 KB
testcase_01 AC 18 ms
6,500 KB
testcase_02 AC 17 ms
6,428 KB
testcase_03 AC 17 ms
6,500 KB
testcase_04 AC 17 ms
6,452 KB
testcase_05 AC 18 ms
6,428 KB
testcase_06 AC 18 ms
6,504 KB
testcase_07 AC 18 ms
6,504 KB
testcase_08 AC 18 ms
6,524 KB
testcase_09 AC 17 ms
6,452 KB
testcase_10 AC 18 ms
6,564 KB
testcase_11 AC 18 ms
6,416 KB
testcase_12 AC 17 ms
6,564 KB
testcase_13 AC 18 ms
6,500 KB
testcase_14 AC 18 ms
6,520 KB
testcase_15 AC 18 ms
6,428 KB
testcase_16 AC 17 ms
6,616 KB
testcase_17 AC 17 ms
6,428 KB
testcase_18 AC 18 ms
6,640 KB
testcase_19 AC 17 ms
6,600 KB
testcase_20 AC 18 ms
6,428 KB
testcase_21 AC 17 ms
6,520 KB
testcase_22 AC 18 ms
6,504 KB
testcase_23 AC 17 ms
6,500 KB
testcase_24 AC 18 ms
6,424 KB
testcase_25 AC 17 ms
6,612 KB
testcase_26 AC 17 ms
6,504 KB
testcase_27 AC 18 ms
6,456 KB
testcase_28 AC 17 ms
6,620 KB
testcase_29 AC 18 ms
6,424 KB
testcase_30 AC 18 ms
6,620 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

primeTable= [True for i in range(10001)]
primeTable[0]=False
primeTable[1]=False
primeList = []
for i in range(10001):
   if primeTable[i] == True:
      for j in range(i+i, 10001,i ):
         primeTable[j] =False
      primeList.append(i)

N=int(raw_input())
grundy = 0
for p in primeList:
   if N%p == 0:
      cnt = 0
      while N%p == 0:
         N/=p
         cnt+=1
      grundy ^= cnt
if N != 1:
   grundy ^= 1

if grundy != 0:
   print "Alice"
else:
   print "Bob"


0