結果
| 問題 | No.185 和風 |
| コンテスト | |
| ユーザー |
mosmos_21
|
| 提出日時 | 2016-10-12 22:31:50 |
| 言語 | C90(gcc12) (gcc 12.4.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 302 bytes |
| 記録 | |
| コンパイル時間 | 137 ms |
| コンパイル使用メモリ | 28,612 KB |
| 最終ジャッジ日時 | 2026-02-23 22:32:38 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 WA * 1 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:4:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
4 | scanf("%d%d%d", &n, &x, &y);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:11:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%d%d", &x, &y);
| ^~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
int main(){
int n, x, y, a, i;
scanf("%d%d%d", &n, &x, &y);
a = y - x;
if(a < 0){
printf("-1\n");
return 0;
}
while(--n){
scanf("%d%d", &x, &y);
i = y - x;
if(a != i){
printf("-1\n");
return 0;
}
}
printf("%d\n", a);
return 0;
}
mosmos_21