結果

問題 No.553 AlphaCoder Rating
ユーザー maimai
提出日時 2017-08-04 10:58:35
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 1,500 ms
コード長 1,107 bytes
コンパイル時間 2,214 ms
コンパイル使用メモリ 197,936 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-20 20:54:35
合計ジャッジ時間 3,163 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;

typedef float numeric;

numeric large_f_inf;

numeric large_f(int n){
    numeric num = 0;
    numeric den = 0;
    
    for (int i = 1; i <= n; ++i){
        num += pow(0.81, (numeric)i);
        den += pow(0.9, (numeric)i);
    }
    return sqrt(num)/den;
}

numeric small_f(int n){
    return 1200*(large_f(n) - large_f_inf) / (large_f(1) - large_f_inf);
}

numeric g(numeric x){
    return pow(2.0, x/800.0);
}

numeric g_inv(numeric y){
    return 800.0*log2(y);
}

numeric rating(vector<numeric>& rperf){
    int n = rperf.size();
    numeric num = 0;
    numeric den = 0;
    for (int i = 1; i <= n; ++i){
        num += g(rperf[i-1])*pow(0.9, (numeric)i);
        den += pow(0.9, (numeric)i);
    }
    return g_inv(num/den) - small_f(n);
}


void initialize(){
    large_f_inf = large_f(10000);
}

int main(){
    initialize();
    
    int n;
    cin >> n;
    vector<numeric> pf;
    
    for (int i = 0; i < n; ++i){
        double p;
        cin >> p;
        pf.push_back(p);
    }
    
    cout << floor(rating(pf)) << endl;
    
    return 0;
}
0