No.553 AlphaCoder Rating
Problem Statement
On AlphaCoder, a user's rating is calculated from their contest performances.
Let RPerf1...RPerfN be the performances in order from newest to oldest (assuming that performances have been calculated N times so far). The rating is then given as follows.
$ F(n)=\dfrac{\sqrt{\sum_{i=1}^{n}0.81^i}}{\sum_{i=1}^{n}0.9^i} $
$ f(n)=\dfrac{F(n)-F(\infty)}{F(1)-F(\infty)} \times 1200 $
$ g(X)=2.0^\tfrac{X}{800} $
$ Rating_n = g^{-1} (\dfrac{\sum_{i=1}^n g(RPerf_i) \times 0.9^i}{\sum_{i=1}^n 0.9^i}) - f(n) $
Here, g^-1 denotes the inverse function of g
(Addendum: solving y=(an expression in x) for x and then swapping x and y gives the inverse function. However, this addendum was added after the contest, so the difficulty is not changed because of it).
Given the number of participations N and the performances RPerf1...RPerfN, calculate the rating as an integer. An absolute error of ±1 is allowed.
Input
N RPerf1 ... RPerfN
Line 1: the number of participations (1≤N≤100)
Lines 2 to N-1: RPerfi (1≤i≤N)
Constraints:
1000≤RPerfi≤4000
Note that Ratingi is assumed never to be negative
(for this reason, 1500≤RPerfi is guaranteed in random cases)
Output
Output RatingN on one line.
Sample
Sample 1
Input
1 2000
Output
800
The average performance is 2000 and f(1)=1200, so the rating is 800.
Sample 2
Input
2 2000 2000
Output
1255
f(2)=745.4.
Sample 3
Input
3 1500 2000 2500
Output
1492
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。