結果
問題 |
No.21 平均の差
|
ユーザー |
![]() |
提出日時 | 2023-05-31 13:26:13 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 452 bytes |
コンパイル時間 | 972 ms |
コンパイル使用メモリ | 28,672 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-28 13:46:44 |
合計ジャッジ時間 | 1,190 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 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[n - 1] - nums[0]; printf("%d", a); return 0; }