結果

問題 No.198 キャンディー・ボックス2
ユーザー fine
提出日時 2016-01-11 00:32:48
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 169 bytes
コンパイル時間 215 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-09-19 18:41:08
合計ジャッジ時間 3,578 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21 WA * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - b
Syntax OK

ソースコード

diff #

b = gets.to_i
n = gets.to_i
c = STDIN.map(&:to_i)
ans = []
n.times{|i|
    standard = c[i]
    ans.push(c.map{|candy|(candy - standard).abs}.inject(&:+))
    }
p ans.min
0