結果

問題 No.185 和風
ユーザー the10hoursthe10hours
提出日時 2015-07-20 22:38:49
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 59 ms / 1,000 ms
コード長 763 bytes
コンパイル時間 3,295 ms
コンパイル使用メモリ 99,772 KB
実行使用メモリ 20,816 KB
最終ジャッジ日時 2023-09-22 20:47:43
合計ジャッジ時間 4,294 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
20,544 KB
testcase_01 AC 59 ms
20,616 KB
testcase_02 AC 56 ms
18,760 KB
testcase_03 AC 57 ms
18,636 KB
testcase_04 AC 58 ms
20,796 KB
testcase_05 AC 57 ms
20,816 KB
testcase_06 AC 58 ms
18,788 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.Collections.Generic;
using System.Linq;
using System.Text;

class yc2
{
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        string[] str1;
        int[,] X = new int[2,N];

        for(int i=0;i<N;i++)
        {
            str1 = Console.ReadLine().Split();
            X[0,i] = int.Parse(str1[0]);
            X[1,i] = int.Parse(str1[1]);
            if (X[1, i] - X[0, i] < 1)
            {
                Console.WriteLine(-1);
                return;
            }
            else if (i >= 1 && X[1, i] - X[0, i] != X[1, i - 1] - X[0, i - 1])
            {
                Console.WriteLine(-1);
                return;
            }
        }
        Console.WriteLine(X[1, 0] - X[0, 0]);
    }
}
0