結果
| 問題 |
No.2 素因数ゲーム
|
| コンテスト | |
| ユーザー |
👑 SPD_9X2
|
| 提出日時 | 2020-01-21 01:18:51 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 816 bytes |
| コンパイル時間 | 152 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-07-02 23:32:21 |
| 合計ジャッジ時間 | 2,192 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 27 WA * 4 |
ソースコード
def Sieve(n): #n以下の素数全列挙(O(nloglogn)) retは素数が入ってる。divlisはその数字の素因数が一つ入ってる
ret = []
divlis = [-1] * (n+1) #何で割ったかのリスト(初期値は-1)
flag = [True] * (n+1)
flag[0] = False
flag[1] = False
ind = 2
while ind <= n:
if flag[ind]:
ret.append(ind)
ind2 = ind ** 2
while ind2 <= n:
flag[ind2] = False
divlis[ind2] = ind
ind2 += ind
ind += 1
return ret,divlis
N = int(input())
ret,divs = Sieve(1000)
ans = 0
for i in ret:
now = 0
while N % i == 0:
N //= i
now += 1
ans ^= now
if N != 1:
ans ^= 1
if ans == 0:
print ("Bob")
else:
print ("Alice")
SPD_9X2