結果
問題 | No.185 和風 |
ユーザー |
|
提出日時 | 2016-03-31 13:22:22 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 208 ms / 1,000 ms |
コード長 | 470 bytes |
コンパイル時間 | 2,047 ms |
コンパイル使用メモリ | 73,984 KB |
実行使用メモリ | 54,576 KB |
最終ジャッジ日時 | 2024-10-02 08:24:22 |
合計ジャッジ時間 | 3,717 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 |
ソースコード
package yukicoder185; import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int res=-1; for(int i=0;i<n;i++){ int x=sc.nextInt(); int y=sc.nextInt(); if(i==0){ if(y-x>0){ res=y-x; }else{ System.out.println(-1); return; } }else{ if(y-x!=res){ System.out.println(-1); return; } } } System.out.println(res); } }