結果
| 問題 |
No.185 和風
|
| コンテスト | |
| ユーザー |
カルロス
|
| 提出日時 | 2015-09-15 16:19:49 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 582 bytes |
| コンパイル時間 | 672 ms |
| コンパイル使用メモリ | 20,096 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-19 06:36:41 |
| 合計ジャッジ時間 | 760 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
5 | scanf("%d", &N);
| ^~~~~~~~~~~~~~~
main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%d %d", &x, &y);
| ^~~~~~~~~~~~~~~~~~~~~~
main.c:14:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | scanf("%d %d", &x, &y);
| ^~~~~~~~~~~~~~~~~~~~~~
main.c:17:13: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
17 | scanf("%d %d", &x, &y);
| ^~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int main(void){
int i, N, x, y, z, flg = 0;
scanf("%d", &N);
if(N==1){
scanf("%d %d", &x, &y);
if(x<y){
printf("%d\n", y-x);
}else{
printf("-1\n");
}
}else{
scanf("%d %d", &x, &y);
z = y - x;
for(i=1;i<N;i++){
scanf("%d %d", &x, &y);
if((y-x)!=z || x>=y){
flg = 1;
break;
}
}if(!flg){
printf("%d\n", z);
}else{
printf("-1\n");
}
}
return 0;
}
カルロス