結果
| 問題 | No.185 和風 |
| コンテスト | |
| ユーザー |
mits58
|
| 提出日時 | 2016-07-02 21:53:24 |
| 言語 | Java (openjdk 26.0.2.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 113 ms / 1,000 ms |
| + 55µs | |
| コード長 | 416 bytes |
| 記録 | |
| コンパイル時間 | 1,270 ms |
| コンパイル使用メモリ | 85,572 KB |
| 実行使用メモリ | 48,208 KB |
| 最終ジャッジ日時 | 2026-09-14 09:25:57 |
| 合計ジャッジ時間 | 3,223 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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