結果

問題 No.553 AlphaCoder Rating
ユーザー vtr_codervtr_coder
提出日時 2017-08-12 00:28:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,500 ms
コード長 1,302 bytes
コンパイル時間 1,452 ms
コンパイル使用メモリ 162,844 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-21 00:15:40
合計ジャッジ時間 2,166 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))

#define MOD 1000000007
#define INF 1000000000

double F_INF;

double F(int n) {
    double child = 0;
    double par = 0;
    for(int i = 1; i <= n; ++i) {
        child += pow(0.81, (double)i);
        par += pow(0.9, (double)i);
    }
    child = sqrt(child);
    return child / par;
}
double f(int n) {
    double child = F(n) - F_INF;
    double par = F(1) - F_INF;
    return child * 1200 / par;
}
double inv_g(double x) {
    return 800 * log2(x);
}
double g(double x) {
    return pow(2.0, x / 800);
}

int N;
double rperf[200];
int main()
{
    // あらかじめ F(INF) っぽい値を計算
    F_INF = 0.229416;//F(20000000);
    //printf("%f", F_INF);
    cin >> N;
    for(int i = 1; i <= N; ++i) {
        cin >> rperf[i];
    }
    double x;
    double child = 0;
    double par = 0;
    for(int i=1; i <= N; ++i) {
        child += g(rperf[i]) * pow(0.9, (double)i);
        par += pow(0.9, (double)i);
    }
    x = child / par;
    //printf("%f\n", f(N));
    //printf("%f\n", inv_g(x));
    printf("%f\n", inv_g(x) - f(N));


    return 0;
}
0