結果

問題 No.1134 Deviation Score Ⅱ
ユーザー kurotemkokurotemko
提出日時 2020-07-29 18:44:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 33 ms / 2,000 ms
コード長 922 bytes
コンパイル時間 2,077 ms
コンパイル使用メモリ 201,200 KB
実行使用メモリ 4,948 KB
最終ジャッジ日時 2023-09-12 09:22:59
合計ジャッジ時間 3,631 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 27 ms
4,448 KB
testcase_02 AC 19 ms
4,380 KB
testcase_03 AC 23 ms
4,608 KB
testcase_04 AC 11 ms
4,376 KB
testcase_05 AC 27 ms
4,396 KB
testcase_06 AC 8 ms
4,380 KB
testcase_07 AC 7 ms
4,376 KB
testcase_08 AC 22 ms
4,384 KB
testcase_09 AC 5 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 18 ms
4,380 KB
testcase_12 AC 18 ms
4,380 KB
testcase_13 AC 29 ms
4,752 KB
testcase_14 AC 19 ms
4,384 KB
testcase_15 AC 13 ms
4,380 KB
testcase_16 AC 7 ms
4,380 KB
testcase_17 AC 18 ms
4,380 KB
testcase_18 AC 19 ms
4,376 KB
testcase_19 AC 25 ms
4,608 KB
testcase_20 AC 14 ms
4,376 KB
testcase_21 AC 25 ms
4,488 KB
testcase_22 AC 21 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 4 ms
4,376 KB
testcase_26 AC 33 ms
4,948 KB
testcase_27 AC 1 ms
4,380 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);

    // すべて同じ値のとき、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;

}
0