結果

問題 No.185 和風
ユーザー matsuyoshi30
提出日時 2016-02-26 00:09:03
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 626 bytes
コンパイル時間 2,306 ms
コンパイル使用メモリ 74,192 KB
実行使用メモリ 56,740 KB
最終ジャッジ日時 2024-09-22 13:47:58
合計ジャッジ時間 4,004 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Main {
    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] x = new int[n];
        int[] y = new int[n];
        for(int i=0; i<n; i++) {
            x[i] = in.nextInt();
            y[i] = in.nextInt();
        }

        int answer = y[0] - x[0];
        int ans = 0;

        if(answer <= 0) {
            ans = -1;
        }

        for(int i=1; i<n; i++) {
            if(y[i] - x[i] != answer) {
                ans = -1;
            }
        }

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