結果
| 問題 | No.185 和風 |
| コンテスト | |
| ユーザー |
nCk_cv
|
| 提出日時 | 2015-04-20 12:13:05 |
| 言語 | Java (openjdk 27.0.1.0.3 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 189 ms / 1,000 ms |
| + 994µs | |
| コード長 | 426 bytes |
| 記録 | |
| コンパイル時間 | 2,006 ms |
| コンパイル使用メモリ | 93,140 KB |
| 実行使用メモリ | 50,844 KB |
| 最終ジャッジ日時 | 2026-11-12 12:04:40 |
| 合計ジャッジ時間 | 5,437 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
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