結果

問題 No.185 和風
ユーザー jimanojimano
提出日時 2018-01-13 19:10:36
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 418 bytes
コンパイル時間 3,465 ms
コンパイル使用メモリ 71,704 KB
実行使用メモリ 58,748 KB
最終ジャッジ日時 2023-08-25 15:58:54
合計ジャッジ時間 5,421 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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();
				ans = y - x;

				if (ans != y - x || ans < 0) {
					ans = -1;
					break;
				}
			}

			System.out.println(ans);
		}
	}
}
0