結果
問題 |
No.185 和風
|
ユーザー |
|
提出日時 | 2019-09-13 13:50:24 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 348 bytes |
コンパイル時間 | 509 ms |
コンパイル使用メモリ | 63,104 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-04 03:47:31 |
合計ジャッジ時間 | 978 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 WA * 1 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:20:13: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized] 20 | cout << ans << endl; | ^~~ main.cpp:7:9: note: 'ans' was declared here 7 | int ans; | ^~~
ソースコード
#include <iostream> using namespace std; int main() { int n, x, y; int ans; cin >> n; for (int i = 0; i < n; i++) { cin >> x >> y; if (y - x < 0 || (i != 0 && ans != y - x)) { ans = -1; break; } ans = y - x; } cout << ans << endl; return 0; }