結果

問題 No.81 すべて足すだけの簡単なお仕事です。
ユーザー koyumeishi
提出日時 2014-11-28 00:50:53
言語 Ruby
(3.4.1)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 375 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 7,296 KB
実行使用メモリ 12,544 KB
最終ジャッジ日時 2024-12-26 09:54:23
合計ジャッジ時間 4,192 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other RE * 30
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require 'bigdecimal'


n = BigDecimal.new(gets)

ans = BigDecimal.new("0")
i = 0
while i<n do
	x = BigDecimal.new(gets)
	ans += x
	i += 1
end

if ans < 0 then
	ans = BigDecimal(ans).ceil(10)
else
	ans = BigDecimal(ans).floor(10)
end

s = ans.to_s("F")

arr = s.split(".")

print arr[0]
print "."
arr[1] += "0000000000"
print arr[1][0..9]
print "\n"
0