結果
問題 | No.185 和風 |
ユーザー | Shawn stayC |
提出日時 | 2020-05-25 22:25:58 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 367 bytes |
コンパイル時間 | 1,764 ms |
コンパイル使用メモリ | 165,224 KB |
実行使用メモリ | 4,384 KB |
最終ジャッジ日時 | 2023-08-03 04:28:28 |
合計ジャッジ時間 | 2,615 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,380 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 2 ms
4,380 KB |
testcase_03 | AC | 2 ms
4,376 KB |
testcase_04 | AC | 2 ms
4,384 KB |
testcase_05 | WA | - |
testcase_06 | AC | 2 ms
4,380 KB |
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内: main.cpp:21:25: 警告: ‘ans’ may be used uninitialized [-Wmaybe-uninitialized] 21 | cout << ans << endl; | ^~~ main.cpp:8:21: 備考: ‘ans’ はここで定義されています 8 | int a,b,pre,ans; cin>>a>>b; | ^~~
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i=0; i<(n); i++) using namespace std; typedef long long ll; int main(){ int n; cin>>n; int a,b,pre,ans; cin>>a>>b; pre=b-a; rep(i,n){ cin>>a>>b; ans=b-a; if(pre!=ans){ cout << "-1" << endl; return 0; } else if(pre<0||ans<0){ cout << "-1" << endl; return 0; } } cout << ans << endl; }