結果

問題 No.185 和風
ユーザー r.suzukir.suzuki
提出日時 2015-12-28 21:31:07
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 456 bytes
コンパイル時間 5,673 ms
コンパイル使用メモリ 74,792 KB
実行使用メモリ 43,416 KB
最終ジャッジ日時 2023-10-19 11:52:46
合計ジャッジ時間 6,807 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 184 ms
41,984 KB
testcase_01 AC 210 ms
43,416 KB
testcase_02 AC 132 ms
41,392 KB
testcase_03 AC 132 ms
41,236 KB
testcase_04 AC 208 ms
43,180 KB
testcase_05 WA -
testcase_06 AC 209 ms
43,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

public class No_185 {

	public static void main(String[] args) {
		java.util.Scanner sc = new java.util.Scanner(System.in);
		int n = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int ans = y - x;

		for (int i = 1; i < n; i++) {
			x = sc.nextInt();
			y = sc.nextInt();
			if (ans != y - x) {
				ans = -1;
				break;
			}
		}

		if (ans >= 0) {
			System.out.println(ans);
		} else {
			System.out.println(-1);
		}
		sc.close();

	}

}
0