結果
問題 | No.143 豆 |
ユーザー |
![]() |
提出日時 | 2015-03-30 23:51:33 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 89 ms / 1,000 ms |
コード長 | 246 bytes |
コンパイル時間 | 58 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 12,288 KB |
最終ジャッジ日時 | 2024-07-23 10:17:03 |
合計ジャッジ時間 | 2,215 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 |
コンパイルメッセージ
Main.rb:11: warning: ambiguous first argument; put parentheses or a space even after `-' operator Main.rb:3: warning: assigned but unused variable - f Syntax OK
ソースコード
class Yukicoder def initialize k, n, f = gets.chomp.split(' ').map(&:to_i) a = gets.chomp.split(' ').map(&:to_i) sum = a.inject(:+) if k * n >= sum puts k * n - sum else puts -1 end end end Yukicoder.new