結果
| 問題 |
No.7 プライムナンバーゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-29 01:35:21 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 369 ms / 5,000 ms |
| コード長 | 557 bytes |
| コンパイル時間 | 192 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 11,264 KB |
| 最終ジャッジ日時 | 2024-10-01 16:32:58 |
| 合計ジャッジ時間 | 3,621 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 |
ソースコード
N = int(input())
def prime_num(end):
lists = [i for i in range(2, end + 1)]
ans = []
while True:
if lists[0] > end ** 0.5:
break
ans.append(lists[0])
lists = list(filter(lambda x:x % lists[0], lists))
return ans + lists
dp = [False for i in range(N + 1)]
prime = prime_num(N)
dp[0], dp[1] = True, True
for i in range(2, N + 1):
for j in prime:
if j > i:
break
if not dp[i - j]:
dp[i] = True
break
print('Win' if dp[N] else 'Lose')