結果
| 問題 |
No.185 和風
|
| コンテスト | |
| ユーザー |
yukiteru
|
| 提出日時 | 2017-10-21 19:55:08 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| コード長 | 729 bytes |
| コンパイル時間 | 1,031 ms |
| コンパイル使用メモリ | 77,420 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-21 12:34:32 |
| 合計ジャッジ時間 | 1,071 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:47:17: warning: 'point' may be used uninitialized [-Wmaybe-uninitialized]
47 | cout << point << endl;
| ^~~~~
main.cpp:24:13: note: 'point' was declared here
24 | int point;
| ^~~~~
ソースコード
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>
#include<list>
#include<bitset>
#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000
using namespace std;
int main(void) {
int n;
int point;
bool flag = false;
cin >> n;
FOR(i, 1, n) {
int a, b;
cin >> a >> b;
if (i == 1) {
if (b - a <= 0) {
point = -1;
flag = true;
}
else {
point = b - a;
}
}
else {
if (b - a != point&&flag==false) {
point = -1;
flag = true;
}
}
}
cout << point << endl;
return 0;
}
yukiteru