这个不必用递归,用循环就可以:
Dim N As Integer
Dim Y As Integer
Dim Gai As Integer
Dim Ping As Integer
Dim Temp As Integer
N = Val(InputBox("输入有几元钱N:"))
Y = N \ 2
Gai = Y
Ping = Y
Do While Gai >= 4 Or Ping >= 2
Y = Y + Int(Gai / 4) + Int(Ping / 2)
Temp = Ping
Ping = Ping Mod 2 + (Int(Gai / 4) + Int(Ping / 2))
Gai = Gai Mod 4 + (Int(Gai / 4) + Int(Temp / 2))
Loop
Print N & "元钱:"
Print "喝酒:" & Y, "余空瓶:" & Ping, "余瓶盖:" & Gai