結果

問題 No.81 すべて足すだけの簡単なお仕事です。
ユーザー 小指が強い人小指が強い人
提出日時 2017-09-24 16:44:12
言語 Ruby
(3.3.0)
結果
AC  
実行時間 97 ms / 5,000 ms
コード長 421 bytes
コンパイル時間 433 ms
コンパイル使用メモリ 11,484 KB
実行使用メモリ 15,300 KB
最終ジャッジ日時 2023-09-29 22:41:42
合計ジャッジ時間 4,406 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
15,028 KB
testcase_01 AC 86 ms
15,068 KB
testcase_02 AC 84 ms
15,256 KB
testcase_03 AC 85 ms
15,168 KB
testcase_04 AC 87 ms
15,032 KB
testcase_05 AC 84 ms
15,244 KB
testcase_06 AC 84 ms
15,072 KB
testcase_07 AC 84 ms
15,192 KB
testcase_08 AC 86 ms
15,056 KB
testcase_09 AC 86 ms
15,200 KB
testcase_10 AC 88 ms
15,068 KB
testcase_11 AC 85 ms
15,072 KB
testcase_12 AC 84 ms
15,200 KB
testcase_13 AC 85 ms
15,248 KB
testcase_14 AC 83 ms
15,104 KB
testcase_15 AC 87 ms
15,264 KB
testcase_16 AC 84 ms
14,984 KB
testcase_17 AC 84 ms
15,068 KB
testcase_18 AC 87 ms
15,180 KB
testcase_19 AC 85 ms
15,276 KB
testcase_20 AC 88 ms
14,976 KB
testcase_21 AC 85 ms
14,996 KB
testcase_22 AC 85 ms
15,200 KB
testcase_23 AC 87 ms
15,300 KB
testcase_24 AC 84 ms
15,104 KB
testcase_25 AC 85 ms
15,244 KB
testcase_26 AC 97 ms
15,092 KB
testcase_27 AC 84 ms
15,004 KB
testcase_28 AC 83 ms
15,132 KB
testcase_29 AC 83 ms
15,280 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i
sum = 0
ku = 10 ** 10
n.times do
    str = gets.strip
    pos = str.index(".")
    if pos != nil
        frac_len = str.length - pos - 1
        str.delete!(".")
        (10 - frac_len).times{str += "0"}
        sum += str.to_i
    else
        sum += str.to_i * ku
    end
end
res = "%025d" % sum
res.insert(-11, ".")
sign = (sum >= 0) ? "" : "-";
a, b = res.split(".")
print sign, a.to_i.abs, ".", b, "\n"
0