結果

問題 No.2 素因数ゲーム
ユーザー sho_00sho_00
提出日時 2020-03-20 19:21:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 740 bytes
コンパイル時間 547 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 117,248 KB
最終ジャッジ日時 2024-05-08 11:24:44
合計ジャッジ時間 7,210 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,880 KB
testcase_01 AC 27 ms
10,752 KB
testcase_02 AC 27 ms
10,880 KB
testcase_03 AC 29 ms
10,752 KB
testcase_04 AC 28 ms
10,880 KB
testcase_05 AC 28 ms
10,880 KB
testcase_06 AC 44 ms
11,008 KB
testcase_07 AC 47 ms
11,008 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
import sys
N=int(input())

def primenumber_table(N):  # N以下の素数テーブル エラトステネスの篩
  table=[i for i in range(2,N+1)]
  l=[]
  while len(table)!=0:
    num=table[0]
    l.append(num)
    i=0
    while i<len(table):
      if table[i]%num==0:
        table.pop(i)
      else:
        i+=1
  return l

table=primenumber_table(int(math.sqrt(N)))
L=[]
init_N=N
while N!=1:
  for num in table:
    cnt=0
    while N%num==0:
      cnt+=1
      N//=num
    if cnt!=0:
      L.append(cnt)
  if N==init_N:
    L.append(1)
    N=1
  elif N in primenumber_table(N):
    L.append(1)
    N=1
grundy_num=0
for i in range(len(L)):
  grundy_num=grundy_num^L[i]
if grundy_num!=0:
  print('Alice')
else:
  print('Bob')
0