package main import "fmt" func main() { var n0, n1, nmax int fmt.Scan(&n0) n := make([]int, 1000) n[0] = n0 nmax = n[0] if n[0] == 1 { n1 = 0 } else { n1 = -1 } for i := 0; i+1 < len(n); i++ { if n[i]%2 == 0 { n[i+1] = n[i] / 2 } else { n[i+1] = 3*n[i] + 1 } if n1 == -1 && n[i+1] == 1 { n1 = i + 1 } nmax = max(nmax, n[i+1]) } // fmt.Println("n0", n0, "n", n) fmt.Println(n1) fmt.Println(nmax) } func max(a, b int) int { if a >= b { return a } return b }