結果

問題 No.21 平均の差
ユーザー yamaken1343yamaken1343
提出日時 2015-11-13 22:06:36
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 260 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 20,736 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-13 14:35:36
合計ジャッジ時間 768 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
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%d",&n,&k);
      |         ^~~~~~~~~~~~~~~~~~~
main.c:6:26: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         for(i=0;i<n;i++) scanf("%d",&nx[i]);
      |                          ^~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
int main(void){
	int max = 0,min = 1000,n,k,i,j;
	int nx[10];
	scanf("%d%d",&n,&k);
	for(i=0;i<n;i++) scanf("%d",&nx[i]);
	for(i=0;i<n;i++){
		if(max<nx[i]) max = nx[i];
		if(min>nx[i]) min = nx[i];
	}
	printf("%d\n",max - min);
	return 0;
}	
0