結果
| 問題 |
No.21 平均の差
|
| コンテスト | |
| ユーザー |
A63295
|
| 提出日時 | 2015-12-18 00:09:08 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 369 bytes |
| コンパイル時間 | 197 ms |
| コンパイル使用メモリ | 20,864 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-16 07:50:24 |
| 合計ジャッジ時間 | 2,654 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | RE * 10 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:21: warning: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘int’ [-Wformat=]
9 | scanf ( "%d", n[i]);
| ~^ ~~~~
| | |
| | int
| int *
main.c:6:6: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf ( "%d", &N);
| ^~~~~~~~~~~~~~~~~
main.c:7:6: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf ( "%d", &K);
| ^~~~~~~~~~~~~~~~~
main.c:9:11: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf ( "%d", n[i]);
| ^~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int main(void){
int i , max, min, N, K, n[11];
max = 0;
min = 1000;
scanf ( "%d", &N);
scanf ( "%d", &K);
for ( i = 0; i < N; i++){
scanf ( "%d", n[i]);
}
for( i = 0; i < N; i++){
if ( max < n[i])
max = n[i];
if (min > n[i])
min = n[i];
}
printf("%d\n",max -min);
return 0;
}
A63295