結果

問題 No.553 AlphaCoder Rating
ユーザー simansiman
提出日時 2023-04-13 23:08:08
言語 Ruby
(3.3.0)
結果
AC  
実行時間 90 ms / 1,500 ms
コード長 533 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,672 KB
最終ジャッジ日時 2024-04-18 01:19:34
合計ジャッジ時間 2,552 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
12,416 KB
testcase_01 AC 81 ms
12,416 KB
testcase_02 AC 81 ms
12,288 KB
testcase_03 AC 84 ms
12,416 KB
testcase_04 AC 85 ms
12,288 KB
testcase_05 AC 85 ms
12,288 KB
testcase_06 AC 84 ms
12,672 KB
testcase_07 AC 85 ms
12,672 KB
testcase_08 AC 83 ms
12,416 KB
testcase_09 AC 84 ms
12,416 KB
testcase_10 AC 84 ms
12,544 KB
testcase_11 AC 84 ms
12,416 KB
testcase_12 AC 84 ms
12,544 KB
testcase_13 AC 82 ms
12,416 KB
testcase_14 AC 90 ms
12,416 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
perfs = N.times.map { gets.to_i }

def lf(n)
  a = 0
  b = 0
  1.upto(n) do |i|
    a += 0.81 ** i
    b += 0.9 ** i
  end

  Rational(Math.sqrt(a), b)
end

def f(n)
  a = Math.sqrt(Rational(0.81, 0.19))
  b = Rational(0.9, 0.1)
  inf_f = Rational(a, b)

  Rational(lf(n) - inf_f, lf(1) - inf_f) * 1200
end

def g(x)
  2.0 ** Rational(x, 800)
end

def rg(x)
  800 * Math.log2(x)
end

a = 0
b = 0

1.upto(N) do |i|
  a += g(perfs[i - 1]) * (0.9 ** i)
  b += 0.9 ** i
end

rate = rg(Rational(a, b)) - f(N)
puts rate.ceil
0