結果
| 問題 |
No.185 和風
|
| コンテスト | |
| ユーザー |
kou6839
|
| 提出日時 | 2015-04-22 12:02:18 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 193 ms / 1,000 ms |
| コード長 | 568 bytes |
| コンパイル時間 | 2,140 ms |
| コンパイル使用メモリ | 74,076 KB |
| 実行使用メモリ | 43,856 KB |
| 最終ジャッジ日時 | 2024-07-05 00:09:51 |
| 合計ジャッジ時間 | 3,825 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 |
ソースコード
import java.util.Scanner;
public class Main {
static int[] tatesum,yokosum;
public static void main(String[] args){
// TODO 自動生成されたメソッド・スタブ
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int ans=0;
for(int i=0;i<n;i++){
int x = sc.nextInt();
int y = sc.nextInt();
if(y-x>0){
if(ans==0){
ans=y-x;
}else{
if(ans==y-x){
}else{
System.out.println(-1);
return;
}
}
}else{
System.out.println(-1);
return;
}
}
System.out.println(ans);
}
}
kou6839