結果
| 問題 |
No.185 和風
|
| コンテスト | |
| ユーザー |
Tsukasa_Type
|
| 提出日時 | 2018-02-09 18:13:01 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 530 bytes |
| コンパイル時間 | 2,111 ms |
| コンパイル使用メモリ | 74,644 KB |
| 実行使用メモリ | 43,636 KB |
| 最終ジャッジ日時 | 2024-10-07 20:00:10 |
| 合計ジャッジ時間 | 4,319 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 WA * 1 |
ソースコード
import java.util.*;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int n = sc.nextInt();
int[] ar = new int[n];
for (int i=0; i<n; i++) {
int a = sc.nextInt();
int b = sc.nextInt();
ar[i] = b - a;
}
boolean exist = true;
for (int i=0; i<n-1; i++) {
if (ar[i]!=ar[i+1]) {exist = false;}
}
if (exist==false) {
System.out.println(-1);
}
else {
if (ar[0]<0) {System.out.println(-1);}
else {System.out.println(ar[0]);}
}
}
}
Tsukasa_Type