package main import ( "bufio" "fmt" "os" "strconv" ) func getScanner(fp *os.File) *bufio.Scanner { scanner := bufio.NewScanner(fp) scanner.Split(bufio.ScanWords) scanner.Buffer(make([]byte, 1000005), 1000005) return scanner } func getNextString(scanner *bufio.Scanner) string { scanner.Scan() return scanner.Text() } func getNextInt(scanner *bufio.Scanner) int { i, _ := strconv.Atoi(getNextString(scanner)) return i } func getNextInt64(scanner *bufio.Scanner) int64 { i, _ := strconv.ParseInt(getNextString(scanner), 10, 64) return i } func getNextUint64(scanner *bufio.Scanner) uint64 { i, _ := strconv.ParseUint(getNextString(scanner), 10, 64) return i } func getNextFloat64(scanner *bufio.Scanner) float64 { i, _ := strconv.ParseFloat(getNextString(scanner), 64) return i } func main() { fp := os.Stdin wfp := os.Stdout cnt := 0 if os.Getenv("MASPY") == "ますピ" { fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT")) cnt = 1 } if os.Getenv("MASPYPY") == "ますピッピ" { wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10")) } scanner := getScanner(fp) writer := bufio.NewWriter(wfp) solve(scanner, writer) for i := 0; i < cnt; i++ { fmt.Fprintln(writer, "-----------------------------------") solve(scanner, writer) } writer.Flush() } func solve(scanner *bufio.Scanner, writer *bufio.Writer) { n := getNextInt(scanner) k := getNextInt(scanner) taro := make([]float64, n*6+1) taro[0] = 1 jiro := make([]float64, n*6+1) jiro[0] = 1 for t := 0; t < n; t++ { for i := n * 6; i > t; i-- { taro[i] = 0 jiro[i] = 0 for j := 1; j <= 6; j++ { if i-j >= 0 { jiro[i] += jiro[i-j] / 6 } } if t < k { for j := 4; j <= 6; j++ { if i-j >= 0 { taro[i] += taro[i-j] / 3 } } continue } for j := 1; j <= 6; j++ { if i-j >= 0 { taro[i] += taro[i-j] / 6 } } } for i := t; i >= 0; i-- { taro[i] = 0 jiro[i] = 0 } } var ans float64 for i := 1; i < n*6+1; i++ { s := 0.0 for j := 1; j < i; j++ { s += jiro[j] } ans += s * taro[i] } fmt.Fprintln(writer, ans) }