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