結果
| 問題 |
No.7 プライムナンバーゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-07-23 00:33:50 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 609 bytes |
| コンパイル時間 | 352 ms |
| コンパイル使用メモリ | 12,032 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2025-07-23 00:33:53 |
| 合計ジャッジ時間 | 3,169 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 WA * 10 |
ソースコード
def main():
N = int(input())
pn = []
dp = [0] * (N + 1)
for i in range(2, N + 1): #素数の確保
for j in range(2, int(i ** 0.5) + 1):
if i % j == 0:
break
else:
pn.append(i)
dp[0] = dp[1] = 1
for i in range(2, N + 1):
for j in pn:
if j > i:
break
if dp[i - j] == 1:
dp[i] = 2
break
if dp[i] == 0:
dp[i] = 1
if dp[N] == 2:
print("Win")
else:
print("Lose")
if __name__=='__main__':
main()