結果
| 問題 | No.185 和風 |
| コンテスト | |
| ユーザー |
ぺ
|
| 提出日時 | 2017-06-15 18:25:59 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 271 bytes |
| コンパイル時間 | 157 ms |
| コンパイル使用メモリ | 22,272 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-25 02:23:08 |
| 合計ジャッジ時間 | 678 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 WA * 2 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d%d%d",&n,&x,&y);
| ~~~~~^~~~~~~~~~~~~~~~~~~
main.cpp:9:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%d%d",&x,&y);
| ~~~~~^~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
int main()
{
int n,x,y,z,f,i;
scanf("%d%d%d",&n,&x,&y);
z=y-x;
for(i=1;i<n;i++){
scanf("%d%d",&x,&y);
if((y-x)!=z){
f=1;
break;
}
}
if(f==1){
puts("-1");
}else if(z<0){
puts("-1");
}else{
printf("%d\n",z);
}
return 0;
}
ぺ