結果

問題 No.385 カップ麺生活
ユーザー angel_p_57
提出日時 2016-09-18 09:38:31
言語 Ruby
(3.4.1)
結果
AC  
実行時間 148 ms / 2,000 ms
コード長 166 bytes
コンパイル時間 46 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 15,616 KB
最終ジャッジ日時 2024-10-04 22:50:37
合計ジャッジ時間 5,178 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:2: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

require"prime"
m,n,*c=$<.read.split.map &:to_i
s=m/c.min
a=[]
f=->x{a[x]||=c.map{|e|x==e ?1:(x>e&&0<t=f[x-e])?t+1:0}.max}
Prime.each(m).reverse_each{|p|s+=f[m-p]}
p s
0