結果

問題 No.185 和風
ユーザー misk703misk703
提出日時 2018-05-14 12:42:01
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 582 bytes
コンパイル時間 3,783 ms
コンパイル使用メモリ 73,544 KB
実行使用メモリ 58,800 KB
最終ジャッジ日時 2023-09-10 19:45:46
合計ジャッジ時間 5,323 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 180 ms
53,680 KB
testcase_01 AC 201 ms
58,684 KB
testcase_02 AC 195 ms
58,512 KB
testcase_03 AC 200 ms
58,800 KB
testcase_04 AC 190 ms
58,348 KB
testcase_05 WA -
testcase_06 AC 196 ms
58,080 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.Scanner;

public class Wahu {

    public static void main(String[] args) {
	Scanner s = new Scanner(System.in);
	int N = Integer.parseInt(s.nextLine());
	ArrayList<Integer> list = new ArrayList<>();
	for(int i=0;i<N;i++){
	    int a = s.nextInt();
	    int b = s.nextInt();
	    list.add(b-a);
	}
	int buff = list.get(0);
	if(buff < 0){
	    System.out.println(-1);
	    return;
	}
	for(int i=1;i<list.size();i++){
	    if(buff != list.get(i)){
		System.out.println(-1);
		return;
	    }
	}
	System.out.println(buff);
	return;
    }

}
0