結果
| 問題 | No.185 和風 |
| コンテスト | |
| ユーザー |
nCk_cv
|
| 提出日時 | 2015-04-20 12:13:05 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 114 ms / 1,000 ms |
| コード長 | 426 bytes |
| 記録 | |
| コンパイル時間 | 1,729 ms |
| コンパイル使用メモリ | 81,200 KB |
| 実行使用メモリ | 46,416 KB |
| 最終ジャッジ日時 | 2026-03-26 01:02:40 |
| 合計ジャッジ時間 | 3,085 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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