結果

問題 No.1134 Deviation Score Ⅱ
ユーザー SSRS
提出日時 2020-11-10 07:26:08
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 503 bytes
コンパイル時間 607 ms
コンパイル使用メモリ 73,600 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-22 17:11:14
合計ジャッジ時間 1,775 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
const double EPS = 0.0001;
int main(){
	int N;
	cin >> N;
	vector<int> x(N);
	for (int i = 0; i < N; i++){
		cin >> x[i];
	}
	int M;
	cin >> M;
	M--;
	double m = 0;
	for (int i = 0; i < N; i++){
		m += x[i];
	}
	m /= N;
	double v = 0;
	for (int i = 0; i < N; i++){
		v += pow(x[i] - m, 2);
	}
	v /= N;
	double s = sqrt(v);
	if (s < EPS){
		cout << 50 << endl;
	} else {
		cout << (int) (50 + (x[M] - m) / s * 10) << endl;
	};
}
0