結果
| 問題 |
No.185 和風
|
| コンテスト | |
| ユーザー |
umashika
|
| 提出日時 | 2016-02-01 22:23:14 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 437 bytes |
| コンパイル時間 | 128 ms |
| コンパイル使用メモリ | 20,352 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-21 19:55:32 |
| 合計ジャッジ時間 | 681 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%d",&n);
| ^~~~~~~~~~~~~~
main.c:11:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%d %d",&x,&y);
| ^~~~~~~~~~~~~~~~~~~~
main.c:16:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
16 | scanf("%d %d",&x,&y);
| ^~~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
int main(void)
{
int i,n;
int x,y,z;
int dif = 0;
int flag = 0;
scanf("%d",&n);
//最初の差を基準にする
scanf("%d %d",&x,&y);
dif=y-x;
//2番目から最後までを確認する
for(i=1;i<n;i++){
scanf("%d %d",&x,&y);
if((y-x)!=dif || y-x<=0){
flag = 1;
break;
}
}
if(!flag){
printf("%d\n",dif);
}
else{
printf("-1\n");
}
return 0;
}
umashika