結果

問題 No.185 和風
ユーザー hamray
提出日時 2017-11-17 22:33:30
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 597 bytes
コンパイル時間 661 ms
コンパイル使用メモリ 72,736 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-25 08:53:42
合計ジャッジ時間 1,120 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
#include<math.h>
#include<stack>
using namespace std;
int main(void){
    int N; cin >> N;
    int X, Y, cnt = 0;
    for(int i = 0; i < N; i++){
        cin >> X >> Y;
        if(i == 0) {
            cnt = Y - X;
        }else{
            if(cnt == Y - X){
                continue;
            }else{
                cnt = -1;
                break;
            }
        }
    }
    if(cnt < 0){
        cout << -1 << endl;
    }else{
        cout << cnt << endl;
    }
    return 0;
}
0