結果

問題 No.1134 Deviation Score Ⅱ
ユーザー kurotemkokurotemko
提出日時 2020-07-29 00:15:02
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 723 bytes
コンパイル時間 2,857 ms
コンパイル使用メモリ 194,584 KB
最終ジャッジ日時 2025-01-12 07:24:34
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 23 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#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);

    int m;
    cin >> m;

    double tmp = abs(x[m-1]-t)*10/t2;

    int ans;
    if(x[m-1] > t) ans = 50 + tmp;
    else ans = 50 - tmp;

    cout << ans << endl;

}
0