結果

問題 No.553 AlphaCoder Rating
ユーザー okadukiokaduki
提出日時 2017-08-11 22:56:26
言語 Ruby
(3.2.2)
結果
AC  
実行時間 76 ms / 1,500 ms
コード長 542 bytes
コンパイル時間 380 ms
コンパイル使用メモリ 11,432 KB
実行使用メモリ 15,612 KB
最終ジャッジ日時 2023-08-02 23:19:23
合計ジャッジ時間 2,786 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
15,488 KB
testcase_01 AC 72 ms
15,604 KB
testcase_02 AC 71 ms
15,612 KB
testcase_03 AC 72 ms
15,444 KB
testcase_04 AC 70 ms
15,604 KB
testcase_05 AC 71 ms
15,560 KB
testcase_06 AC 71 ms
15,440 KB
testcase_07 AC 70 ms
15,440 KB
testcase_08 AC 74 ms
15,500 KB
testcase_09 AC 71 ms
15,368 KB
testcase_10 AC 73 ms
15,596 KB
testcase_11 AC 70 ms
15,476 KB
testcase_12 AC 70 ms
15,604 KB
testcase_13 AC 73 ms
15,524 KB
testcase_14 AC 76 ms
15,472 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

$finf = Math.sqrt(100.0 / 19 - 1) / 9.0
def F(n)
  d = 0.0
  c = 0.0
  (1..n).each do |i|
    d += 0.81 ** i
    c += 0.9 ** i
  end
  d = Math.sqrt(d)
  d / c
end

def f(n)
  (F(n) - $finf) / (F(1) - $finf) * 1200.0
end

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

def gi(y)
  Math.log(y) / Math.log(2) * 800
end

def rating(n, rs)
  d = 0.0
  c = 0.0
  (1..n).each do |i|
    d += g(rs[i-1]) * (0.9 ** i)
    c += 0.9 ** i
  end
  gi(d/c) - f(n)
end

n = gets.to_i
xs = []
(0..n-1).each do |i|
  x = gets.to_f
  xs << x
end

puts rating(n, xs).to_i
0