結果
問題 |
No.1134 Deviation Score Ⅱ
|
ユーザー |
|
提出日時 | 2020-07-29 18:44:48 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 39 ms / 2,000 ms |
コード長 | 922 bytes |
コンパイル時間 | 1,866 ms |
コンパイル使用メモリ | 194,840 KB |
最終ジャッジ日時 | 2025-01-12 07:38:00 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 27 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; // 入力と、その総和 double t = 0; vector<double> x(n); for(int i = 0; i < n; ++i) { cin >> x[i]; t += x[i]; } // 平均点 t /= (double)n; // 平均点との差の平方根と、その総和 double t2 = 0; vector<double> x2(n); for(int i = 0; i < n; ++i) { x2[i] = pow(abs(t - x[i]), 2); t2 += x2[i]; } // 平均と、その平方根 t2 /= (double)n; t2 = sqrt(t2); // すべて同じ値のとき、t2=0になってしまう if(t2 < 0.1) t2 = 1; int m; cin >> m; // 点数と平均点の差*10/(2) double tmp = abs(x[m-1]-t)*10/t2; // 点数が平均点より高ければ50+(3)、違うなら50-(3) int ans; if(x[m-1] > t) ans = 50 + tmp; else ans = 50 - tmp; cout << ans << endl; }