結果

問題 No.21 平均の差
ユーザー mosmos_21mosmos_21
提出日時 2016-01-21 20:28:05
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 239 bytes
コンパイル時間 144 ms
コンパイル使用メモリ 20,440 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-21 13:42:35
合計ジャッジ時間 730 ms
ジャッジサーバーID
(参考情報)
judge9 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 0 ms
4,348 KB
testcase_06 AC 0 ms
4,348 KB
testcase_07 AC 0 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 0 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 %d", &n ,&k);
      |         ^~~~~~~~~~~~~~~~~~~~~~
main.c:11:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |                 scanf("%d", &t);
      |                 ^~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(){
	
	int min = 1000, max = 0;
	int n ,k, i, t;

	scanf("%d %d", &n ,&k);

	for(i = 0; i < n; i++){
		scanf("%d", &t);
		if(t < min) min = t;
		if(max < t) max = t;
	}

	printf("%d\n", max - min);

	return 0;
}
0