結果

問題 No.553 AlphaCoder Rating
ユーザー Konton7Konton7
提出日時 2020-02-02 00:55:12
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,500 ms
コード長 1,287 bytes
コンパイル時間 2,156 ms
コンパイル使用メモリ 204,484 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 00:28:29
合計ジャッジ時間 2,950 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using PII = std::pair<int, int>;
using PLL = std::pair<ll, ll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
// #define DEBUG

double const f1inf = sqrt(1 / 0.19) / 10;

double f1(int n)
{
    double s1, s2, s;
    s1 = s2 = 0;
    s = 1;
    rep(i, n)
    {
        s *= 0.9;
        s1 += s;
        s2 += s * s;
    }

    return sqrt(s2) / s1;
}

double f(int n)
{
    return 1200.0 * (f1(n) - f1inf) / (f1(1) - f1inf);
}

double g(int x)
{
    return pow(2.0, ((1.0 * x) / 800.0));
}

double g_inv(double x)
{
    return 800.0 * log2(x);
}

double h(int n, vector<int> perf)
{
    double s, t;
    s = 0;
    t = 1;
    rep(i, n)
    {
        t *= 0.9;
        s += t * g(perf[i]);
    }
    return s;
}

double rating(int n, vector<int> perf)
{
    return g_inv(h(n, perf) / (9.0 * (1 - pow(0.9, n)))) - f(n);
}

int main()
{

#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf());    //for debug
#endif

    int n, p;
    vector<int> perf;
    cin >> n;
    rep(i, n)
    {
        cin >> p;
        perf.push_back(p);
    }

    printf("%.0f\n", rating(n, perf));

    return 0;
}
0