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