結果
| 問題 | No.185 和風 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-01-08 01:45:44 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 395 bytes |
| 記録 | |
| コンパイル時間 | 592 ms |
| コンパイル使用メモリ | 63,588 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-23 01:49:37 |
| 合計ジャッジ時間 | 1,140 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / 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:5:9: note: 'ans' was declared here
5 | int ans;
| ^~~
ソースコード
#include <iostream>
using namespace std;
int main(){
int n;cin>>n;
int ans;
for(int i = 0; n > i; i++){
int a,b;cin>>a>>b;
if(a > b){
cout << -1 << endl;
return 0;
}
if(!i){
ans = b-a;
}
if(b-a != ans){
cout << -1 << endl;
return 0;
}
}
cout << ans << endl;
}