結果
問題 |
No.185 和風
|
ユーザー |
![]() |
提出日時 | 2016-02-01 22:23:40 |
言語 | C90 (gcc 12.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 438 bytes |
コンパイル時間 | 91 ms |
コンパイル使用メモリ | 20,352 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-21 19:55:33 |
合計ジャッジ時間 | 574 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 2 WA * 1 RE * 3 OLE * 1 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:19:7: warning: ‘return’ with no value, in function returning non-void 19 | return; | ^~~~~~ main.c:2:5: note: declared here 2 | int main(void) | ^~~~ 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; return; } } if(!flag){ printf("%d\n",dif); } else{ printf("-1\n"); } return 0; }