結果

問題 No.21 平均の差
コンテスト
ユーザー dgd1724
提出日時 2016-09-08 18:12:19
言語 C++11
(gcc 15.3.0 + boost 1.92.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 5,000 ms
+ 309µs
コード長 496 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 351 ms
コンパイル使用メモリ 90,260 KB
実行使用メモリ 9,836 KB
最終ジャッジ日時 2026-09-23 18:04:49
合計ジャッジ時間 1,813 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <time.h>
#include <cstdlib>
#include <cmath>
#include <fstream>

int main(void) {

	//test用
	//std::ifstream in("test.txt");
	//std::cin.rdbuf(in.rdbuf());

	int N, K;
	std::cin >> N >> K;

	int max = 0;
	int min = 1000;

	for (int i = 0; i < N; i++) {
		int temp;
		std::cin >> temp;
		if (temp >= max) {
			max = temp;
		}
		if (temp <= min) {
			min = temp;
		}
	}

	std::cout << max - min << std::endl;
}
0