結果
問題 |
No.185 和風
|
ユーザー |
![]() |
提出日時 | 2019-01-08 22:50:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 269 bytes |
コンパイル時間 | 481 ms |
コンパイル使用メモリ | 63,104 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-24 00:49:34 |
合計ジャッジ時間 | 937 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:20:17: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized] 20 | cout << ans << endl; | ^~~ main.cpp:11:13: note: 'ans' was declared here 11 | int ans; | ^~~
ソースコード
#include <iostream> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { int n; cin >> n; int ans; rep(i, n) { int x, y; cin >> x >> y; int z = y - x; ans = (z > 0 && (i == 0 || ans == z)) ? z : -1; } cout << ans << endl; }