結果
| 問題 | No.7 プライムナンバーゲーム |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-07-23 00:39:11 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 195 ms / 5,000 ms |
| + 450µs | |
| コード長 | 634 bytes |
| 記録 | |
| コンパイル時間 | 54 ms |
| コンパイル使用メモリ | 14,976 KB |
| 実行使用メモリ | 11,264 KB |
| 最終ジャッジ日時 | 2026-10-11 11:02:40 |
| 合計ジャッジ時間 | 2,789 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 |
ソースコード
def main():
N = int(input())
pn = []
dp = [False] * (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] = False
for i in range(2, N + 1):
for j in pn:
if j > i:
break
if i - j <= 1:
continue
if dp[i - j] == False:
dp[i] = True
break
if dp[N] == True:
print("Win")
else:
print("Lose")
if __name__=='__main__':
main()