結果
| 問題 |
No.185 和風
|
| コンテスト | |
| ユーザー |
tenkyu9
|
| 提出日時 | 2018-01-20 00:48:37 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 505 bytes |
| コンパイル時間 | 747 ms |
| コンパイル使用メモリ | 67,944 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-24 12:58:16 |
| 合計ジャッジ時間 | 1,282 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 |
コンパイルメッセージ
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