結果
問題 | No.2 素因数ゲーム |
ユーザー |
![]() |
提出日時 | 2020-03-20 19:21:42 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 740 bytes |
コンパイル時間 | 251 ms |
コンパイル使用メモリ | 12,928 KB |
実行使用メモリ | 818,380 KB |
最終ジャッジ日時 | 2024-12-14 15:04:15 |
合計ジャッジ時間 | 35,546 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 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')