結果
| 問題 |
No.185 和風
|
| コンテスト | |
| ユーザー |
matsuyoshi30
|
| 提出日時 | 2016-02-26 00:09:42 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 205 ms / 1,000 ms |
| コード長 | 635 bytes |
| コンパイル時間 | 2,166 ms |
| コンパイル使用メモリ | 74,208 KB |
| 実行使用メモリ | 56,892 KB |
| 最終ジャッジ日時 | 2024-09-22 13:48:15 |
| 合計ジャッジ時間 | 4,228 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 |
ソースコード
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) {
answer = -1;
}
for(int i=1; i<n; i++) {
if(y[i] - x[i] != answer) {
answer = -1;
}
}
System.out.println(answer);
}
}
matsuyoshi30