結果

問題 No.553 AlphaCoder Rating
ユーザー olpheolphe
提出日時 2017-08-11 23:02:26
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,500 ms
コード長 1,203 bytes
コンパイル時間 927 ms
コンパイル使用メモリ 104,004 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-02 23:23:32
合計ジャッジ時間 1,968 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;
const long double EPS = 0.00000001;

long long int N, M, K, Q, W, H, L, R;
long long int ans;

long long int num[200000];

long double F(int n) {
	long double a = 0, b = 0;
	for (int i = 1; i <= n; i++) {
		a += pow(0.81, i);
		b += pow(0.9, i);
	}
	return sqrt(a) / b;
}

long double f(int n) {
	return (F(n) - 0.22941573387) / (F(1) - 0.22941573387)*1200;
}

long double G(long double n){
	return pow(2.0, n / 800.0);
}

long double rating(int n) {
	long double a = 0, b = 0;
	for (int i = 0; i < n; i++) {
		a += G(num[i])*pow(0.9, i + 1);
		b += pow(0.9, i+1);
	}
	long double l = 0, r = 5000;
	long double mid = 2500;
	while(abs(G(mid)-a/b)>EPS){
		mid = (l + r)/2;
		if (G(mid) > a / b)r = mid;
		else l = mid;
		//cout << G(mid)<<" "<<mid << endl;
	}
	return mid - f(n);
}

int main() {
	ios::sync_with_stdio(false);
	cin >> N;
	for (int i = 0; i < N; i++)cin >> num[i];
	cout << round(rating(N)) << endl;
	return 0;
}
0