結果
問題 |
No.185 和風
|
ユーザー |
![]() |
提出日時 | 2017-11-19 18:07:01 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,348 bytes |
コンパイル時間 | 1,142 ms |
コンパイル使用メモリ | 104,192 KB |
実行使用メモリ | 18,304 KB |
最終ジャッジ日時 | 2024-11-25 23:59:25 |
合計ジャッジ時間 | 1,866 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 WA * 1 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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]; int check = 0; 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 (s[i, 1] - s[i, 0] < 0) { check++; } } if (check != 0) { Console.WriteLine(-1); } else { if (n == 1) { 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]) { check++; break; } } if (check != 0) { Console.WriteLine(-1); } else { Console.WriteLine(s[0, 1] - s[0, 0]); } } } Console.ReadLine(); } } }