結果

問題 No.553 AlphaCoder Rating
ユーザー okadukiokaduki
提出日時 2017-08-11 22:56:26
言語 Ruby
(3.3.0)
結果
AC  
実行時間 84 ms / 1,500 ms
コード長 542 bytes
コンパイル時間 471 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,544 KB
最終ジャッジ日時 2024-04-20 23:14:03
合計ジャッジ時間 2,471 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
12,544 KB
testcase_01 AC 79 ms
12,288 KB
testcase_02 AC 80 ms
12,544 KB
testcase_03 AC 84 ms
12,288 KB
testcase_04 AC 75 ms
12,544 KB
testcase_05 AC 75 ms
12,544 KB
testcase_06 AC 75 ms
12,288 KB
testcase_07 AC 76 ms
12,544 KB
testcase_08 AC 76 ms
12,288 KB
testcase_09 AC 77 ms
12,416 KB
testcase_10 AC 74 ms
12,288 KB
testcase_11 AC 77 ms
12,416 KB
testcase_12 AC 78 ms
12,288 KB
testcase_13 AC 80 ms
12,288 KB
testcase_14 AC 80 ms
12,544 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