結果
問題 |
No.185 和風
|
ユーザー |
|
提出日時 | 2016-11-23 21:42:00 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 259 bytes |
コンパイル時間 | 190 ms |
コンパイル使用メモリ | 20,480 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-27 10:21:42 |
合計ジャッジ時間 | 589 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:5:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 5 | scanf("%d",&n); | ^~~~~~~~~~~~~~ main.c:7:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%d%d",&x,&y); | ^~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h> int main(void){ int x,y,n,k,i; scanf("%d",&n); for(i = 1;i <= n;i++){ scanf("%d%d",&x,&y); if(y-x <= 0){printf("-1\n");return 0;} if(i == 1){k = y-x;} else if(y-x != k){printf("-1\n");return 0;} } printf("%d\n",k); return 0; }