結果
| 問題 |
No.185 和風
|
| コンテスト | |
| ユーザー |
croonalullaby
|
| 提出日時 | 2017-08-03 10:34:45 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 682 bytes |
| コンパイル時間 | 1,987 ms |
| コンパイル使用メモリ | 164,492 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-11 20:20:46 |
| 合計ジャッジ時間 | 2,190 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 WA * 1 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:33:9: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
33 | printf("%d\n",ans);
| ~~~~~~^~~~~~~~~~~~
main.cpp:24:7: note: 'ans' was declared here
24 | int ans;
| ^~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
//--------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3
//--------------------------------------------
const double EPS = 1e-14;
const double PI = acos(-1.0);
//--------------------------------------------
int main(){
int n;
int x,y;
scanf("%d",&n);
int ans;
REP(i, n) {
scanf("%d %d",&x, &y);
if (i == 0) {
if (x > y) ans = -1;
else ans = y - x;
} else if (y - x != ans) ans = -1;
}
printf("%d\n",ans);
}
croonalullaby