結果

問題 No.185 和風
ユーザー kimny
提出日時 2017-11-19 17:45:25
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,090 bytes
コンパイル時間 3,896 ms
コンパイル使用メモリ 102,912 KB
実行使用メモリ 18,048 KB
最終ジャッジ日時 2024-11-25 23:57:50
合計ジャッジ時間 4,678 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 WA * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace yukicoder_185 {
    class Program {
        static void Main(string[] args) {
            int n = int.Parse(Console.ReadLine());
            int[,]s = new int[n, 2];
            for (int i = 0; i < n; i++) {
                string[] t = Console.ReadLine().Split(' ');
                s[i, 0] = int.Parse(t[0]);
                s[i, 1] = int.Parse(t[1]);
            }
            if (n == 1) {
                if (s[0, 1] - s[0, 0] < 0) {
                    Console.WriteLine(-1);
                } else {
                    Console.WriteLine(s[0, 1] - s[0, 0]);
                }
            } else {
                for (int i = 1; i < n; i++) {
                    if (s[i, 1] - s[i, 0] != s[i - 1, 1] - s[i - 1, 0]) {
                        Console.WriteLine(-1);
                        break;
                    }
                    Console.WriteLine(s[0, 1] - s[0, 0]);
                }
            }
            Console.ReadLine();
        }
    }
}
0