結果

問題 No.185 和風
ユーザー カルロスカルロス
提出日時 2015-09-15 16:19:49
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 582 bytes
コンパイル時間 1,274 ms
コンパイル使用メモリ 23,496 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-26 12:04:27
合計ジャッジ時間 1,824 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 0 ms
4,380 KB
testcase_03 AC 0 ms
4,380 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0