結果
| 問題 | No.904 サメトロ |
| コンテスト | |
| ユーザー |
tomomo2b2
|
| 提出日時 | 2019-10-11 21:33:20 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 906 bytes |
| コンパイル時間 | 992 ms |
| コンパイル使用メモリ | 113,396 KB |
| 実行使用メモリ | 29,316 KB |
| 最終ジャッジ日時 | 2024-11-25 06:50:29 |
| 合計ジャッジ時間 | 3,049 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 WA * 14 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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();
}
}
tomomo2b2