結果

問題 No.185 和風
ユーザー YamaKasaYamaKasa
提出日時 2018-04-27 02:10:24
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 557 bytes
コンパイル時間 2,043 ms
コンパイル使用メモリ 72,272 KB
実行使用メモリ 58,952 KB
最終ジャッジ日時 2023-09-10 06:00:33
合計ジャッジ時間 4,316 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 182 ms
56,456 KB
testcase_01 AC 191 ms
58,776 KB
testcase_02 AC 193 ms
58,300 KB
testcase_03 AC 195 ms
58,328 KB
testcase_04 AC 195 ms
58,256 KB
testcase_05 WA -
testcase_06 AC 191 ms
58,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int []X = new int[N];
		int []Y = new int[N];
		for(int i = 0; i < N; i++) {
			X[i] = scan.nextInt();
			Y[i] = scan.nextInt();
		}
		scan.close();
		int z = Y[0] - X[0];
		if(z < 0) {
			System.out.println(-1);
			System.exit(0);
		}
		for(int i = 1; i < N; i++) {
			int temp = Y[i] - X[i];
			if(z != temp) {
				System.out.println(-1);
				System.exit(0);
			}
		}
		System.out.println(z);
	}
}
0