結果

問題 No.185 和風
ユーザー mits58
提出日時 2016-07-02 21:52:44
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 415 bytes
コンパイル時間 2,210 ms
コンパイル使用メモリ 74,032 KB
実行使用メモリ 43,764 KB
最終ジャッジ日時 2024-10-12 01:16:18
合計ジャッジ時間 4,262 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 WA * 1
権限があれば一括ダウンロードができます

ソースコード

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