結果

問題 No.185 和風
ユーザー shimashima_k
提出日時 2015-04-27 12:16:44
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 355 bytes
コンパイル時間 1,370 ms
コンパイル使用メモリ 157,312 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-05 04:51:22
合計ジャッジ時間 1,939 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;

int main() {
    int n, a, b,c, f=0;
    cin >> n;
    n--;
    cin >> a>>b;
    c = b-a;
    if (c <= 0) f=1;
    while (n--) {
        cin>>a>>b;
        if (b-a != c){
            cout<<-1<<endl;
            return 0;
        }
    }
    if(f==1) cout<<-1<<endl;
    else cout << c <<endl;
    return 0;
}
0