結果
| 問題 |
No.185 和風
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-01-13 19:54:59 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 216 ms / 1,000 ms |
| コード長 | 487 bytes |
| コンパイル時間 | 3,656 ms |
| コンパイル使用メモリ | 75,056 KB |
| 実行使用メモリ | 43,208 KB |
| 最終ジャッジ日時 | 2024-12-24 00:57:52 |
| 合計ジャッジ時間 | 5,645 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 |
ソースコード
package me.yukicoder.lv1;
import java.util.Scanner;
public class No0185 {
public static void main(String[] args) {
try (Scanner sc = new Scanner(System.in)) {
int N = sc.nextInt();
int ans = 0;
int tmp = 0;
for (int i = 0; i < N; i++) {
int x = sc.nextInt();
int y = sc.nextInt();
ans = y - x;
if (i == 0) {
tmp = ans;
}
if (ans < 1 || tmp != ans) {
ans = -1;
break;
}
tmp = ans;
}
System.out.println(ans);
}
}
}