結果
問題 |
No.385 カップ麺生活
|
ユーザー |
![]() |
提出日時 | 2016-08-04 01:24:46 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 148 ms / 2,000 ms |
コード長 | 184 bytes |
コンパイル時間 | 117 ms |
コンパイル使用メモリ | 7,296 KB |
実行使用メモリ | 15,488 KB |
最終ジャッジ日時 | 2024-10-04 22:44:44 |
合計ジャッジ時間 | 5,078 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
コンパイルメッセージ
Main.rb:2: warning: assigned but unused variable - n Syntax OK
ソースコード
require'prime' m,n,*c=$<.read.split.map &:to_i d=[-1]*m<<0 m.downto(1){|i|c.map{|j|d[i-j]=[d[i-j],d[i]+1].max if d[i]>=0&&j<=i}} p d.max+(0..m).inject{|p,c|p+(c.prime?&&d[c]>0?d[c]:0)}