結果

問題 No.81 すべて足すだけの簡単なお仕事です。
ユーザー maimai
提出日時 2016-09-04 01:38:12
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 338 bytes
コンパイル時間 66 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-04-27 16:11:44
合計ジャッジ時間 3,297 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
12,288 KB
testcase_01 AC 81 ms
12,416 KB
testcase_02 AC 84 ms
12,416 KB
testcase_03 WA -
testcase_04 AC 77 ms
12,160 KB
testcase_05 AC 76 ms
12,160 KB
testcase_06 AC 75 ms
12,416 KB
testcase_07 AC 78 ms
12,160 KB
testcase_08 AC 75 ms
12,288 KB
testcase_09 AC 76 ms
12,160 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 77 ms
12,160 KB
testcase_14 AC 74 ms
12,288 KB
testcase_15 AC 75 ms
12,160 KB
testcase_16 AC 73 ms
12,160 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 76 ms
12,160 KB
testcase_26 AC 73 ms
12,288 KB
testcase_27 WA -
testcase_28 AC 75 ms
12,160 KB
testcase_29 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i

e10 = 10**10
sum = 0
n.times{|i|
    cin = gets.chomp!
    if /^-?\d+$/=~cin
       sum += cin.to_i*e10
    else
        t = cin.scan(/(-?)(\d+)\.(\d+)/)[0]
        k = t[1].to_i*e10 + t[2].to_i*10**(10-t[2].size)
        k = -k if t[0]=="-"
        sum += k
    end
}

nu = sum/e10
fr = sum%e10
printf("%d.%010d\n",nu,fr)
0