結果
| 問題 |
No.185 和風
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-05-20 23:30:02 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 338 bytes |
| コンパイル時間 | 528 ms |
| コンパイル使用メモリ | 19,712 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-06 05:53:53 |
| 合計ジャッジ時間 | 1,240 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:9: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | fscanf(stdin, "%d", &n);
| ^~~~~~~~~~~~~~~~~~~~~~~
main.c:8:9: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | fscanf(stdin, "%ld %ld", &x, &y);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:13:17: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | fscanf(stdin, "%ld %ld", &x, &y);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int main(void) {
// your code goes here
int n, i;
long x, y, ans;
fscanf(stdin, "%d", &n);
fscanf(stdin, "%ld %ld", &x, &y);
ans = y - x;
if (ans < 1)
ans = -1;
for(i = 0; i < n; i++){
fscanf(stdin, "%ld %ld", &x, &y);
if(ans != (y - x)){
ans = -1;
break;
}
}
printf("%ld\n", ans);
return 0;
}