結果

問題 No.553 AlphaCoder Rating
ユーザー cielciel
提出日時 2017-06-25 16:42:10
言語 Ruby
(3.3.0)
結果
AC  
実行時間 82 ms / 1,500 ms
コード長 412 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,672 KB
最終ジャッジ日時 2024-04-20 20:53:52
合計ジャッジ時間 1,939 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#!/usr/bin/ruby
def x(a,r,n)
  if n<0
    a/(1-r)
  else
    a*(1-r**n)/(1-r)
  end
end
def f0(n)
  Math.sqrt(x(0.81,0.81,n))/x(0.9,0.9,n)
end
def f(n)
  (f0(n)-f0(-1)) / (f0(1)-f0(-1)) * 1200
end
def g(n)
  2.0 ** (n/800.0)
end
def gi(n)
  800*Math.log(n,2)
end
def h(a)
  s=0
  r=1
  a.size.times{|i|
    r*=0.9
    s+=g(a[i])*r
  }
  gi(s / x(0.9,0.9,a.size)) - f(a.size)
end
p h($<.map(&:to_i).drop(1)).round
0