結果

問題 No.65 回数の期待値の練習
ユーザー wotsushiwotsushi
提出日時 2017-03-23 21:41:41
言語 Ruby
(3.2.2)
結果
AC  
実行時間 794 ms / 5,000 ms
コード長 131 bytes
コンパイル時間 207 ms
コンパイル使用メモリ 11,264 KB
実行使用メモリ 16,156 KB
最終ジャッジ日時 2023-09-19 06:44:02
合計ジャッジ時間 4,680 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,240 KB
testcase_01 AC 83 ms
15,272 KB
testcase_02 AC 83 ms
15,276 KB
testcase_03 AC 82 ms
15,140 KB
testcase_04 AC 85 ms
15,264 KB
testcase_05 AC 84 ms
15,248 KB
testcase_06 AC 83 ms
15,280 KB
testcase_07 AC 84 ms
15,272 KB
testcase_08 AC 82 ms
15,148 KB
testcase_09 AC 85 ms
15,068 KB
testcase_10 AC 86 ms
15,056 KB
testcase_11 AC 89 ms
15,516 KB
testcase_12 AC 92 ms
15,804 KB
testcase_13 AC 97 ms
15,808 KB
testcase_14 AC 107 ms
16,144 KB
testcase_15 AC 132 ms
16,152 KB
testcase_16 AC 174 ms
16,108 KB
testcase_17 AC 265 ms
16,156 KB
testcase_18 AC 449 ms
16,084 KB
testcase_19 AC 794 ms
15,904 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

K = gets.to_i
def f(k)
  if k >= K
    0.0
  else
    1 + ((1..6).map {|i| f(k + i)}.inject(:+) / 6)
  end
end
ans = f(0)
puts ans
0