結果

問題 No.185 和風
ユーザー asdfghjkl;asdfghjkl;
提出日時 2020-03-12 13:00:11
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 359 bytes
コンパイル時間 339 ms
コンパイル使用メモリ 28,272 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-11 04:45:59
合計ジャッジ時間 1,059 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,384 KB
testcase_06 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main(void){
int n;scanf("%d",&n);
int a[1005],b[1005];

for(int i=0;i<n;i++){
    scanf("%d %d",&a[i],&b[i]);
}

int sab=b[0]-a[0];
int sab2;
for(int i=1;i<n;i++){
    sab2=b[i]-a[i];
    if(sab!=sab2){printf("-1\n");return 0;}
    else if(sab2<=0){printf("-1\n");return 0;}
}
printf("%d\n",sab);

}
0