結果
問題 | No.7 プライムナンバーゲーム |
ユーザー | DialBird |
提出日時 | 2016-11-14 10:14:58 |
言語 | Ruby (3.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 296 bytes |
コンパイル時間 | 202 ms |
コンパイル使用メモリ | 11,376 KB |
実行使用メモリ | 20,120 KB |
最終ジャッジ日時 | 2023-08-17 04:36:19 |
合計ジャッジ時間 | 9,059 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 94 ms
15,484 KB |
testcase_01 | AC | 99 ms
15,564 KB |
testcase_02 | AC | 96 ms
15,604 KB |
testcase_03 | AC | 98 ms
15,420 KB |
testcase_04 | AC | 99 ms
15,392 KB |
testcase_05 | AC | 117 ms
15,496 KB |
testcase_06 | AC | 95 ms
15,376 KB |
testcase_07 | AC | 95 ms
15,332 KB |
testcase_08 | AC | 122 ms
15,368 KB |
testcase_09 | AC | 213 ms
15,508 KB |
testcase_10 | AC | 96 ms
15,344 KB |
testcase_11 | AC | 94 ms
15,564 KB |
testcase_12 | TLE | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
コンパイルメッセージ
Main.rb:18: warning: assigned but unused variable - ans Syntax OK
ソースコード
require 'prime' MAX_N = 10000 @dp = [nil]*(MAX_N + 1) def check(n) n.downto(2) do |i| next if !i.prime? next if [0,1].include?(n-i) return @dp[n] = true if !check(n-i) end return @dp[n] = false end def main n = gets.to_i ans = check(n) ? "Win" : "Lose" end puts main()