結果

問題 No.185 和風
ユーザー HaijinnHaijinn
提出日時 2017-08-03 12:28:44
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 333 bytes
コンパイル時間 133 ms
コンパイル使用メモリ 21,120 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-20 01:33:19
合計ジャッジ時間 569 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:11:1: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 | scanf("%d",&n);
      | ^~~~~~~~~~~~~~
main.c:13:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |         scanf("%d%d",&k[i],&y[i]);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>


int main(){
	int i;
	int n;
	int x=0;
	int k[1000],y[1000];
	int z[1000];
	int a;
scanf("%d",&n);
for(i=0;i<n;i++){
	scanf("%d%d",&k[i],&y[i]);
z[i]=y[i]-k[i];
}
a=z[0];
for(i=0;i<n;i++){
	if(a==z[i]){
		
		
		
		x++;
		
	}

	
	
	
	
}
if(x==n&&a>0){
	
	printf("%d\n",a);
	
}else{
	printf("-1\n");
	
}

return 0;
}
0