結果

問題 No.21 平均の差
ユーザー Toshihiko Yanase
提出日時 2018-05-01 16:17:38
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 388 bytes
コンパイル時間 545 ms
コンパイル使用メモリ 63,304 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 00:12:07
合計ジャッジ時間 1,025 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;


int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);


  int N, K;
  cin >> N >> K;
  int vmax = -1;
  int vmin = 100000;

  for(int i=0;i<N;i++){
    int v;
    cin >> v;
    vmax = max(vmax, v);
    vmin = min(vmin, v);
  }

  cout << vmax - vmin << endl;

  return 0;
}
0