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