結果
| 問題 |
No.185 和風
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-12-20 17:43:20 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 211 ms / 1,000 ms |
| コード長 | 531 bytes |
| コンパイル時間 | 2,049 ms |
| コンパイル使用メモリ | 74,160 KB |
| 実行使用メモリ | 43,812 KB |
| 最終ジャッジ日時 | 2024-09-17 12:18:51 |
| 合計ジャッジ時間 | 4,108 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 |
ソースコード
import java.util.*;
import java.math.*;
public class Main{
public static void main(String... args){
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
System.out.println(Calc(n,scan));
}
public static int Calc(int n,Scanner scan){
int result = -1;
for(int i = 0; i < n; i++){
int x = scan.nextInt();
int y = scan.nextInt();
int fx = y-x;
if(i == 0 && 0 < fx){
result = fx;
}else if(result != fx){
result = -1;
}else if(fx <= 0){
result = -1;
}
}
return result;
}
}