package main import ( "bufio" "fmt" "os" "strconv" ) type qe struct { x, y, h, r int } func main() { x := readInt() y := readInt() h := readInt() x *= 1000 y *= 1000 q := make([]qe, 0) q = append(q, qe{x, y, h, 0}) result := 0 for len(q) != 0 { e := q[0] q = q[1:] if e.r > result { result = e.r } if e.x > e.h { q = append(q, qe{e.x / 2, e.y, e.h * 2, e.r + 1}) } if e.y > e.h { q = append(q, qe{e.x, e.y / 2, e.h * 2, e.r + 1}) } } fmt.Println(result) } const ( ioBufferSize = 1 * 1024 * 1024 // 1 MB ) var stdinScanner = func() *bufio.Scanner { result := bufio.NewScanner(os.Stdin) result.Buffer(make([]byte, ioBufferSize), ioBufferSize) result.Split(bufio.ScanWords) return result }() func readString() string { stdinScanner.Scan() return stdinScanner.Text() } func readInt() int { result, err := strconv.Atoi(readString()) if err != nil { panic(err) } return result }