結果

問題 No.185 和風
ユーザー swdamdrswdamdr
提出日時 2017-01-25 13:56:31
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 859 bytes
コンパイル時間 2,091 ms
コンパイル使用メモリ 101,548 KB
実行使用メモリ 22,780 KB
最終ジャッジ日時 2023-08-24 22:09:08
合計ジャッジ時間 3,209 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
18,652 KB
testcase_01 AC 57 ms
20,656 KB
testcase_02 AC 55 ms
22,560 KB
testcase_03 AC 54 ms
22,644 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 56 ms
20,576 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;

class Program
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        int output = -1;
        bool b = true;
        int m = 0;

        for (int i = 0; i < n; i++)
        {
            string[] s = Console.ReadLine().Split();
            int x = int.Parse(s[0]);
            int y = int.Parse(s[1]);

            if (n == 1)
            {
                b = false;
                break;
            }

            if (i == 0)
            {
                m = y - x;
            }
            else if (m != y - x)
            {
                b = false;
                break;
            }
        }

        if (b == true)
        {
            output = m;
        }

        Console.WriteLine(output);
        Console.ReadLine();
    }
}

0