結果

問題 No.904 サメトロ
ユーザー tomomo2b2tomomo2b2
提出日時 2019-10-11 21:33:20
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 906 bytes
コンパイル時間 4,950 ms
コンパイル使用メモリ 104,364 KB
実行使用メモリ 25,868 KB
最終ジャッジ日時 2023-08-16 17:14:44
合計ジャッジ時間 5,129 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
25,684 KB
testcase_01 WA -
testcase_02 AC 52 ms
21,716 KB
testcase_03 WA -
testcase_04 AC 53 ms
23,704 KB
testcase_05 AC 52 ms
23,644 KB
testcase_06 AC 53 ms
19,700 KB
testcase_07 WA -
testcase_08 AC 53 ms
21,648 KB
testcase_09 AC 52 ms
23,712 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 53 ms
23,708 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 55 ms
21,860 KB
testcase_16 WA -
testcase_17 AC 54 ms
21,724 KB
testcase_18 AC 52 ms
21,660 KB
testcase_19 WA -
testcase_20 AC 55 ms
23,636 KB
testcase_21 WA -
testcase_22 AC 53 ms
19,728 KB
testcase_23 WA -
testcase_24 AC 52 ms
21,656 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 53 ms
21,652 KB
testcase_28 AC 53 ms
21,664 KB
testcase_29 AC 52 ms
21,656 KB
testcase_30 WA -
testcase_31 AC 55 ms
21,592 KB
testcase_32 AC 53 ms
21,656 KB
testcase_33 AC 52 ms
21,656 KB
testcase_34 AC 55 ms
21,764 KB
testcase_35 AC 55 ms
21,720 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
using System.Collections.Generic;
using System.IO;

class MyClass
{
    public static void Solve()
    {
        var N = int.Parse(Console.ReadLine());
        var A = new int[N];
        var B = new int[N];
        for (int i = 1; i < N; i++)
        {
            var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            A[i] = input[0];
            B[i] = input[1];
        }
        var sumA = A.Sum();
        var sumB = B.Sum();
        var diff = sumB - sumA;
        if (diff >= 0)
        {
            Console.WriteLine(sumB - diff + 1);
        }
        else
        {
            Console.WriteLine(sumA + diff + 1);
        }
    }

    public static void Main()
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
    }
}
0