結果
問題 | No.81 すべて足すだけの簡単なお仕事です。 |
ユーザー |
|
提出日時 | 2017-02-24 10:12:39 |
言語 | Ruby (3.4.1) |
結果 |
RE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 425 bytes |
コンパイル時間 | 366 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 12,544 KB |
最終ジャッジ日時 | 2024-12-26 10:10:36 |
合計ジャッジ時間 | 4,200 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | RE * 30 |
コンパイルメッセージ
Syntax OK
ソースコード
require 'bigdecimal' require 'bigdecimal/util' class Yukicoder def initialize n = gets.to_i @total = BigDecimal.new("0") n.times do val = BigDecimal.new(gets) @total += val end end def run str = @total.to_s("F") str =~ /^-?\d+\.(\d+)$/ below_zero_count = 10 - Regexp.last_match(1).size below_zero_count.times { str << '0' } return str end end puts Yukicoder.new.run