結果
| 問題 | No.7 プライムナンバーゲーム |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-11-03 21:34:48 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 71 ms / 5,000 ms |
| + 47µs | |
| コード長 | 511 bytes |
| 記録 | |
| コンパイル時間 | 341 ms |
| コンパイル使用メモリ | 81,532 KB |
| 実行使用メモリ | 84,032 KB |
| 最終ジャッジ日時 | 2026-10-11 10:44:31 |
| 合計ジャッジ時間 | 2,252 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 |
ソースコード
N = int(input())
nums = list(range(2, N+1))
primes = []
work = nums[:]
while len(work) > 0:
head = work.pop(0)
primes.append(head)
work = list(filter(lambda x: x % head != 0, work))
win_nums = set()
while len(nums) > 0:
head = nums.pop(0)
for n in primes:
win_num = n + head
if win_num > N:
break
if not win_num in win_nums:
win_nums.add(win_num)
nums.remove(win_num)
if N in win_nums:
print("Win")
else:
print("Lose")