結果

問題 No.185 和風
ユーザー k_kadorak_kadora
提出日時 2015-05-30 19:12:02
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 484 bytes
コンパイル時間 4,171 ms
コンパイル使用メモリ 72,068 KB
実行使用メモリ 58,320 KB
最終ジャッジ日時 2023-09-20 17:48:46
合計ジャッジ時間 6,398 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 182 ms
55,964 KB
testcase_01 AC 199 ms
58,320 KB
testcase_02 AC 197 ms
57,668 KB
testcase_03 AC 194 ms
58,036 KB
testcase_04 AC 192 ms
58,288 KB
testcase_05 WA -
testcase_06 AC 194 ms
58,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Wafu {
	public static void main(String[] arg){
		Scanner sc = new Scanner(System.in);
		int n,temp=0,res=0;
		n = sc.nextInt();
		int[] x = new int[n];
		int[] y = new int[n];
		for(int i = 0;i<n;i++){
			x[i] = sc.nextInt();
			y[i] = sc.nextInt();
		}
		for(int i = 0;i<n;i++){
			if(i ==0){
				temp = y[i] - x[i];
				res = temp;
			}
			if(y[i] - x[i]< 0 || y[i] - x[i] != temp) {
				res = -1;
				break;
			}
		}
		System.out.println(res);
	}
}
0