結果
| 問題 |
No.185 和風
|
| コンテスト | |
| ユーザー |
nCk_cv
|
| 提出日時 | 2015-04-20 12:13:05 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 196 ms / 1,000 ms |
| コード長 | 426 bytes |
| コンパイル時間 | 2,008 ms |
| コンパイル使用メモリ | 74,188 KB |
| 実行使用メモリ | 43,520 KB |
| 最終ジャッジ日時 | 2024-07-04 17:45:51 |
| 合計ジャッジ時間 | 4,157 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 |
ソースコード
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int ans = -1;
for(int i = 0; i < n; i++) {
int a = sc.nextInt();
int b = sc.nextInt();
int c = b - a;
if(i == 0 && c > 0) {
ans = c;
}
else if(ans != c) {
ans = -1;
}
else if(c <= 0) {
ans = -1;
}
}
System.out.println(ans);
}
}
nCk_cv