結果
| 問題 | No.904 サメトロ |
| コンテスト | |
| ユーザー |
tomomo2b2
|
| 提出日時 | 2019-10-11 21:33:20 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 906 bytes |
| 記録 | |
| コンパイル時間 | 671 ms |
| コンパイル使用メモリ | 105,984 KB |
| 実行使用メモリ | 19,840 KB |
| 最終ジャッジ日時 | 2026-05-19 17:50:40 |
| 合計ジャッジ時間 | 2,780 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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