結果

問題 No.1134 Deviation Score Ⅱ
ユーザー kurotemkokurotemko
提出日時 2020-07-29 00:15:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 723 bytes
コンパイル時間 3,354 ms
コンパイル使用メモリ 199,708 KB
実行使用メモリ 4,820 KB
最終ジャッジ日時 2023-09-11 07:01:54
合計ジャッジ時間 3,453 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 27 ms
4,500 KB
testcase_02 AC 19 ms
4,384 KB
testcase_03 AC 23 ms
4,512 KB
testcase_04 AC 11 ms
4,380 KB
testcase_05 AC 26 ms
4,668 KB
testcase_06 AC 8 ms
4,376 KB
testcase_07 AC 7 ms
4,380 KB
testcase_08 AC 23 ms
4,376 KB
testcase_09 AC 6 ms
4,384 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 18 ms
4,384 KB
testcase_12 AC 18 ms
4,380 KB
testcase_13 AC 29 ms
4,820 KB
testcase_14 AC 19 ms
4,376 KB
testcase_15 AC 13 ms
4,384 KB
testcase_16 AC 7 ms
4,376 KB
testcase_17 AC 18 ms
4,380 KB
testcase_18 AC 20 ms
4,380 KB
testcase_19 AC 24 ms
4,500 KB
testcase_20 AC 14 ms
4,380 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 5 ms
4,380 KB
testcase_26 AC 34 ms
4,656 KB
testcase_27 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

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