class Yukicoder def initialize k = gets.chomp.to_i dp = Array.new(k+7, 0.0) (k-1).downto(0) do |x| dp[x] = (x+1..x+6).inject(0){|sum, e| sum += 1/6r * dp[e]} + 1.0 end puts dp[0] end end Yukicoder.new