結果

問題 No.81 すべて足すだけの簡単なお仕事です。
ユーザー しらゆきしらゆき
提出日時 2015-12-31 08:52:31
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 746 bytes
コンパイル時間 1,184 ms
コンパイル使用メモリ 108,900 KB
実行使用メモリ 25,024 KB
最終ジャッジ日時 2023-10-19 12:50:17
合計ジャッジ時間 2,852 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
24,980 KB
testcase_01 AC 29 ms
24,980 KB
testcase_02 AC 29 ms
24,980 KB
testcase_03 WA -
testcase_04 AC 28 ms
24,980 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 30 ms
24,980 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 28 ms
24,980 KB
testcase_14 AC 29 ms
24,980 KB
testcase_15 WA -
testcase_16 WA -
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 28 ms
24,980 KB
testcase_26 AC 28 ms
24,980 KB
testcase_27 WA -
testcase_28 AC 28 ms
24,980 KB
testcase_29 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;

class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var a = new long[n];
        var b = new long[n];
        for (int i = 0; i < n; i++)
        {
            var s = Console.ReadLine().Split('.');
            a[i] = long.Parse(s[0]);
            if (s.Length > 1)
                b[i] = long.Parse(s[1].PadRight(10, '0'));
            if (s[0][0]=='-')
                b[i] = -b[i];
        }

        long t = 10000000000;

        long asum = a.Sum();
        long bsum = b.Sum();
        asum += bsum / t;
        if (bsum < 0)
            bsum -= bsum;
        bsum -= bsum / t * t;

        Console.WriteLine("{0}.{1}", asum, bsum.ToString("D10"));
    }
}
0