結果

問題 No.185 和風
ユーザー startcpp
提出日時 2015-08-14 23:08:41
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 252 bytes
コンパイル時間 362 ms
コンパイル使用メモリ 53,468 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-18 09:30:39
合計ジャッジ時間 756 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;

int n;
int x, y;

int main() {
cin >> n >> x >> y;
int ans = y - x;
for (int i = 1; i < n; i++) {
cin >> x >> y;
if (ans != y - x || ans <= 0) {
cout << -1 << endl;
return 0;
}
}
cout << ans << endl;
return 0;
}
0