結果
| 問題 | No.185 和風 |
| コンテスト | |
| ユーザー |
koukonko
|
| 提出日時 | 2015-12-14 15:12:34 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 846 bytes |
| 記録 | |
| コンパイル時間 | 2,101 ms |
| コンパイル使用メモリ | 72,680 KB |
| 実行使用メモリ | 37,884 KB |
| 最終ジャッジ日時 | 2024-09-15 12:33:03 |
| 合計ジャッジ時間 | 3,252 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 WA * 1 |
ソースコード
package yukicoder;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) {
BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
try {
int N = Integer.parseInt(read.readLine());
int num;
String[] box = read.readLine().split(" ");
int x, y;
x = Integer.parseInt(box[0]);
y = Integer.parseInt(box[1]);
num = y - x;
if (num < 0) {
System.out.println(-1);
return;
}
int i;
for (i = 1; i < N; ++i) {
box = read.readLine().split(" ");
x = Integer.parseInt(box[0]);
y = Integer.parseInt(box[1]);
if (num != (y - x)) {
break;
}
}
if (i < N) {
System.out.println(-1);
} else {
System.out.println(num);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
koukonko