結果

問題 No.185 和風
ユーザー hotpepsi
提出日時 2015-11-04 01:06:30
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 320 bytes
コンパイル時間 405 ms
コンパイル使用メモリ 55,596 KB
実行使用メモリ 6,940 KB
最終ジャッジ日時 2024-09-13 12:21:26
合計ジャッジ時間 860 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstring>

using namespace std;

int main(int argc, char *argv[]) {
	int N;
	cin >> N;
	int x, y;
	cin >> x >> y;
	int ans = y - x;
	if (ans <= 0) {
		ans = -1;
	}
	for (int i = 1; i < N; ++i) {
		cin >> x >> y;
		if ((y - x) != ans) {
			ans = -1;
		}
	}
	cout << ans << endl;
	return 0;
}
0