結果

問題 No.185 和風
ユーザー jimanojimano
提出日時 2018-01-13 19:45:24
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 531 bytes
コンパイル時間 3,903 ms
コンパイル使用メモリ 72,908 KB
実行使用メモリ 56,252 KB
最終ジャッジ日時 2023-08-25 16:00:18
合計ジャッジ時間 3,982 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 97 ms
55,564 KB
testcase_02 AC 98 ms
56,012 KB
testcase_03 AC 110 ms
55,740 KB
testcase_04 AC 111 ms
55,648 KB
testcase_05 AC 120 ms
55,832 KB
testcase_06 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No0185 {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int N = sc.nextInt();
			int ans = 0;

			for (int i = 0; i < N; i++) {
				
				if (i == 0) {
					int x = sc.nextInt();
					int y = sc.nextInt();
					
					if (y - x < 1) {
						ans = -1;
					}
				}
				else {
					int x = sc.nextInt();
					int y = sc.nextInt();
					
					if (y - x != ans) {
						ans = -1;
						break;
					}
				}
				
			}
			System.out.println(ans);

		}
	}
}
0