結果
問題 | No.7 プライムナンバーゲーム |
ユーザー |
|
提出日時 | 2021-12-04 17:46:28 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 606 ms / 5,000 ms |
コード長 | 536 bytes |
コンパイル時間 | 279 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-10-01 16:45:35 |
合計ジャッジ時間 | 4,923 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 |
ソースコード
N = int(input()) dat = [0] * (N+1) prime = [] for i in range(2,N+1): if dat[i] == 0: prime.append(i) j = 2 while i * j <= N: dat[i*j] = 1 j += 1 winlose = [0] * (N+1) winlose[2] = False winlose[3] = False for i in range(4,N+1): for j in prime: if i - j < 2: winlose[i] = False break else: if winlose[i-j] == False: winlose[i] = True break if winlose[N]: print('Win') else: print('Lose')