結果
問題 | No.458 異なる素数の和 |
ユーザー | suppy193 |
提出日時 | 2017-01-13 15:40:22 |
言語 | Ruby (3.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 406 bytes |
コンパイル時間 | 262 ms |
コンパイル使用メモリ | 11,460 KB |
実行使用メモリ | 86,300 KB |
最終ジャッジ日時 | 2023-08-23 10:04:03 |
合計ジャッジ時間 | 8,289 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 99 ms
19,780 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 400 ms
43,920 KB |
testcase_05 | TLE | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
コンパイルメッセージ
Main.rb:29: warning: ambiguous first argument; put parentheses or a space even after `-' operator Syntax OK
ソースコード
require 'prime' @n = gets.strip.to_i @list = [2] 3.step(@n, 2) do |i| if i.prime? @list << i end end #p @list @memo = Array.new(@n + 1, 0) @list.each do |p| #p @memo @next_memo = @memo.clone (0..@n).each do |i| #p key, value if i + p > @n break end @next_memo[i + p] = [@memo[i + p], @memo[i] + 1].max end @memo = @next_memo end #p @memo if @memo[@n] != 0 p @memo[@n] else p -1 end