結果
| 問題 |
No.2 素因数ゲーム
|
| コンテスト | |
| ユーザー |
sho_00
|
| 提出日時 | 2020-03-20 19:02:49 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 723 bytes |
| コンパイル時間 | 190 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 817,972 KB |
| 最終ジャッジ日時 | 2024-12-14 14:17:02 |
| 合計ジャッジ時間 | 34,987 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 26 TLE * 4 MLE * 1 |
ソースコード
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
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')
sho_00