結果

問題 No.21 平均の差
ユーザー hotpepsi
提出日時 2015-03-19 10:19:14
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 444 bytes
コンパイル時間 512 ms
コンパイル使用メモリ 67,608 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 23:12:09
合計ジャッジ時間 1,271 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <sstream>
#include <vector>

using namespace std;

int main(int argc, char *argv[])
{
  string s;
  getline(cin, s);
  int N = atoi(s.c_str());
  getline(cin, s);
  int K = atoi(s.c_str());
  vector<int> A(N);
  for (int i = 0; i < N; ++i) {
    getline(cin, s);
    A[i] = atoi(s.c_str());
  }
  sort(A.begin(), A.end());
  int ans = A.back() - A.front();
  cout << ans << endl;
  return 0;
}
0