結果
| 問題 |
No.185 和風
|
| コンテスト | |
| ユーザー |
mits58
|
| 提出日時 | 2016-07-02 21:53:24 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 211 ms / 1,000 ms |
| コード長 | 416 bytes |
| コンパイル時間 | 2,944 ms |
| コンパイル使用メモリ | 75,196 KB |
| 実行使用メモリ | 43,464 KB |
| 最終ジャッジ日時 | 2024-10-12 01:16:56 |
| 合計ジャッジ時間 | 4,244 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 |
ソースコード
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
while(sc.hasNext()){
int n=sc.nextInt();
int ans=sc.nextInt()-sc.nextInt(); ans=-ans;
for(int i=1;i<n;i++){
int x=sc.nextInt();
int y=sc.nextInt();
int temp=y-x;
if(ans==-1) continue;
if(ans!=temp) ans=-1;
}
System.out.println(ans<=0 ? -1 : ans);
}
}
}
mits58