結果
| 問題 |
No.185 和風
|
| コンテスト | |
| ユーザー |
tenkyu9
|
| 提出日時 | 2018-01-20 00:46:48 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 504 bytes |
| コンパイル時間 | 946 ms |
| コンパイル使用メモリ | 68,376 KB |
| 実行使用メモリ | 6,816 KB |
| 最終ジャッジ日時 | 2024-12-24 12:58:15 |
| 合計ジャッジ時間 | 967 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 WA * 1 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:31:11: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized]
31 | cout << ans << endl;
| ^~~
ソースコード
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include<cstring>
using namespace std;
int main(){
int n, x[1000], y[1000], ans;
cin >> n;
for(int i=0; i<n; i++){
cin >> x[i] >> y[i];
ans=y[0]-x[0];
if(ans<0){
cout << -1 << endl;
return 0;
}
}
for(int i=1; i<n; i++){
if(ans!=(y[i]-x[i])){
cout << -1 << endl;
return 0;
}
}
cout << ans << endl;
return 0;
}
tenkyu9