結果
問題 | No.7 プライムナンバーゲーム |
ユーザー |
|
提出日時 | 2015-08-23 17:34:39 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 1,234 ms / 5,000 ms |
コード長 | 387 bytes |
コンパイル時間 | 115 ms |
コンパイル使用メモリ | 6,784 KB |
実行使用メモリ | 6,528 KB |
最終ジャッジ日時 | 2024-10-01 15:36:34 |
合計ジャッジ時間 | 9,717 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 |
ソースコード
import sys sys.setrecursionlimit(10005) N = int(raw_input()) prime = [] good = [True] * 10101 for i in xrange(2, 10101): if good[i]: prime.append(i) for j in xrange(i * i, 10101, i): good[j] = False dp = [None] * (N + 1) dp[0] = True dp[1] = True for i in xrange(2, N + 1): dp[i] = any([not dp[i - j] for j in prime if j <= i]) if dp[N]: print "Win" else: print "Lose"