結果

問題 No.185 和風
ユーザー jimanojimano
提出日時 2018-01-13 19:27:44
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 434 bytes
コンパイル時間 3,386 ms
コンパイル使用メモリ 71,984 KB
実行使用メモリ 56,328 KB
最終ジャッジ日時 2023-08-25 15:59:46
合計ジャッジ時間 4,867 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 124 ms
55,984 KB
testcase_02 AC 124 ms
55,892 KB
testcase_03 AC 122 ms
55,688 KB
testcase_04 AC 122 ms
55,832 KB
testcase_05 WA -
testcase_06 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package me.yukicoder.lv1;
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++) {
				int x = sc.nextInt();
				int y = sc.nextInt();
				int tmp = y - x;

				if (tmp < 0 || tmp != ans) {
					ans = -1;
					break;
				}
				ans = tmp;
			}
			System.out.println(ans);
		}
	}
}
0