結果

問題 No.185 和風
ユーザー mits58mits58
提出日時 2016-07-02 21:52:44
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 415 bytes
コンパイル時間 2,158 ms
コンパイル使用メモリ 74,740 KB
実行使用メモリ 53,972 KB
最終ジャッジ日時 2024-04-20 06:10:38
合計ジャッジ時間 4,248 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 174 ms
42,236 KB
testcase_01 AC 204 ms
43,436 KB
testcase_02 AC 206 ms
43,404 KB
testcase_03 AC 209 ms
43,408 KB
testcase_04 AC 205 ms
43,372 KB
testcase_05 WA -
testcase_06 AC 206 ms
43,788 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()){
			int n=sc.nextInt();
			int ans=sc.nextInt()-sc.nextInt(); ans=-ans;
			for(int i=1;i<n;i++){
				int x=sc.nextInt();
				int y=sc.nextInt();
				int temp=y-x;
				if(ans==-1) continue;
				if(ans!=temp) ans=-1;
			}
			System.out.println(ans<0 ? -1 : ans);
		}
	}
}
0