結果
| 問題 |
No.185 和風
|
| コンテスト | |
| ユーザー |
sk3388607083
|
| 提出日時 | 2018-06-22 13:22:14 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 412 bytes |
| コンパイル時間 | 106 ms |
| コンパイル使用メモリ | 22,528 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-30 17:56:07 |
| 合計ジャッジ時間 | 528 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 WA * 5 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%d", &N);
| ~~~~~^~~~~~~~~~
main.cpp:10:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | scanf("%d %d", &X, &Y);
| ~~~~~^~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
int main(void){
int i;
int N, X, Y;
int A[1000];
int flag = 0;
scanf("%d", &N);
for(i = 0; i < N; i++){
scanf("%d %d", &X, &Y);
A[i] = Y - X;
}
for(i = 1; i < N; i++){
if(A[0] < 0 || A[i] < 0){
flag = 1;
break;
}
if(A[0] != A[i]){
flag = 1;
break;
}
}
if(flag == 2) printf("-1\n");
else printf("%d\n", A[0]);
return 0;
}
sk3388607083