結果
問題 | No.7 プライムナンバーゲーム |
ユーザー |
![]() |
提出日時 | 2022-10-22 09:37:43 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 52 ms / 5,000 ms |
コード長 | 442 bytes |
コンパイル時間 | 3,929 ms |
コンパイル使用メモリ | 67,068 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-01 13:21:43 |
合計ジャッジ時間 | 5,031 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 |
ソースコード
import sequtils,strutilsvarn = parseInt readLine stdina = true.repeat(n + 1)a[0] = falsea[1] = falsefor i in 2..n:if not a[i]: continuefor j in countup(i * 2,n,i):a[j] = falsevarps = a.pairs.toSeq.filter(proc (x : (int,bool)) : bool = x[1]).unzip[0]dp = true.repeat(n + 1)dp[0] = falsedp[1] = falsefor i in 2..n:for j in ps:if j <= i and dp[i - j]:dp[i] = falseecho if dp[n]: "Lose" else: "Win"