結果

問題 No.553 AlphaCoder Rating
ユーザー cielciel
提出日時 2017-08-11 02:14:34
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 741 bytes
コンパイル時間 120 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,800 KB
最終ジャッジ日時 2024-04-20 20:53:44
合計ジャッジ時間 1,905 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

line = gets.chomp!
abort "format error" unless line=~/^\d+$/
n = line.to_i
abort "1<=n<=100" unless 1<=n && n<=100

rperf = [nil]
n.times{
    line = gets.chomp!
    abort "format error" unless line=~/^\d+$/
    rperf << line.to_r
}
abort "EOF" unless !gets


# 等比数列の和
def sum_seq(a, r, n)
    a*(1.0-r**n) / (1.0-r)
end


def large_f(n)
    n=10000 if n == :inf
    Math.sqrt(sum_seq(0.81,0.81,n)) / sum_seq(0.9,0.9,n)
end

def small_f(n)
    ((large_f(n)-large_f(:inf)) / (large_f(1)-large_f(:inf)))*1200
end

def g(x)
    2.0**(x/800.0)
end

def g_inv(y)
    800.0*Math.log2(y)
end

def rating(n, rperf)
    g_inv((0..n).reduce{|s,i| s+g(rperf[i])*(0.9**i)} / sum_seq(0.9,0.9,n)) - small_f(n)
end

p rating(n, rperf).round + 2
0