题解 | #汽水瓶#
汽水瓶
https://www.nowcoder.com/practice/fe298c55694f4ed39e256170ff2c205f
package main import ( "fmt" ) func main() { var input int for { fmt.Scan(&input) if input == 0 { break } res := 0 for input > 1 { res = res + input/3 input = input/3 + input%3 if input == 2 { res++ break } } fmt.Println(res) } }