結果
問題 |
No.178 美しいWhitespace (1)
|
ユーザー |
|
提出日時 | 2016-08-05 16:35:26 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 96 ms / 2,000 ms |
コード長 | 413 bytes |
コンパイル時間 | 135 ms |
コンパイル使用メモリ | 7,680 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-11-07 00:14:15 |
合計ジャッジ時間 | 3,388 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 |
コンパイルメッセージ
Syntax OK
ソースコード
class Calc0178 def initialize(args) args = args.map { |l| l.chomp.split(/\s+/) } @n = args.shift.first.to_i @lines = args.map { |l| l.map(&:to_i) } end def run ws = @lines.map { |l| l[0] + l[1] * 4 } max = ws.max ws = ws.map { |l| max - l } if ws.any?(&:odd?) -1 else ws.inject(:+) / 2 end end end puts Calc0178.new(STDIN.readlines).run if __FILE__ == $0