結果
問題 | No.21 平均の差 |
ユーザー |
![]() |
提出日時 | 2023-05-31 13:24:47 |
言語 | C (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 451 bytes |
コンパイル時間 | 467 ms |
コンパイル使用メモリ | 28,928 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-28 13:46:36 |
合計ジャッジ時間 | 3,625 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | RE * 10 |
ソースコード
#include <stdio.h> #include <stdlib.h> static int cmp(const void* n1, const void* n2) { if (*(int*)n1 > *(int*)n2) { return 1; } else if (*(int*)n1 < *(int*)n2) { return -1; } else { return 0; } } int main() { int n, k; scanf("%d", &n); scanf("%d", &k); int nums[10]; for (int i = 0; i < n; i++) { scanf("%d", nums[i]); } qsort(nums, n, sizeof(int), cmp); int a = nums[0] - nums[n - 1]; printf("%d", a); return 0; }