結果
問題 | No.385 カップ麺生活 |
ユーザー |
![]() |
提出日時 | 2016-08-04 01:18:41 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 129 ms / 2,000 ms |
コード長 | 187 bytes |
コンパイル時間 | 205 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 15,232 KB |
最終ジャッジ日時 | 2024-10-04 22:43:54 |
合計ジャッジ時間 | 4,392 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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.upto(m).inject{|p,c|p+(c.prime?&&d[c]>0?d[c]:0)}