結果
問題 |
No.21 平均の差
|
ユーザー |
![]() |
提出日時 | 2025-03-07 16:23:51 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 366 bytes |
コンパイル時間 | 452 ms |
コンパイル使用メモリ | 27,648 KB |
実行使用メモリ | 8,608 KB |
最終ジャッジ日時 | 2025-03-07 16:23:53 |
合計ジャッジ時間 | 1,200 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%d", &num); | ~~~~~^~~~~~~~~~~~ main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%d", &group); | ~~~~~^~~~~~~~~~~~~~ main.cpp:13:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%d", &nums[i]); | ~~~~~^~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> int main() { int num = 0; int group = 0; int nums[9] = {0}; scanf("%d", &num); scanf("%d", &group); for (int i = 0;i < num;i++) { scanf("%d", &nums[i]); for (int j = 0;j < num;j++) { if (nums[i] < nums[j]) { int tmp = nums[j]; nums[j] = nums[i]; nums[i] = tmp; } } } printf("%d", nums[num - 1] - nums[0]); }