結果
問題 | No.21 平均の差 |
ユーザー |
![]() |
提出日時 | 2018-04-03 19:09:08 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 352 bytes |
コンパイル時間 | 302 ms |
コンパイル使用メモリ | 36,684 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-26 08:33:33 |
合計ジャッジ時間 | 877 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
コンパイルメッセージ
main.cpp: In function ‘void solve()’: main.cpp:17:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 17 | scanf("%d %d", &n, &k); | ~~~~~^~~~~~~~~~~~~~~~~ main.cpp:19:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 19 | scanf("%d", &A), s = min(s, A), b = max(b, A); | ~~~~~^~~~~~~~~~
ソースコード
#include <stdio.h>#include <algorithm>#include <deque>using namespace std;using ll = long long;void solve();int main() {solve();#ifdef DBGwhile (true);#endif}//21void solve() {int n, k, A, s = 1000, b = 1;scanf("%d %d", &n, &k);for (int i = 0; i < n; i++)scanf("%d", &A), s = min(s, A), b = max(b, A);printf("%d\n", b - s);}