Private Sub Command1_Click()
Dim a, b, s As Integer
a = 1'第9天吃完后就是这一个了,令a=1
For i = 9 To 1 Step -1 '吃之前的桃子数 ,从第九天吃之前开始算起
a = (a + 1) * 2 '每天吃之前剩的桃子数
Next
Print a
End Sub
结果1534个,不是知道是什么猴子这么能吃。。。。
Dim t As Integer
Function Tao(i As Integer) As Integer
If i < 10 Then '如果i<10则条件成立
t = (t + 1) * 2 计算前一天桃子的个数
i = i + 1 '再推前一天
Tao (i) '递归
End If
End Function
Private Sub Command1_Click()
t = 1
Tao (1) '调用Tao
Print t
'结果t=1534
End Sub
Dim
t
As
Integer
Function
Tao(i
As
Integer)
As
Integer
If
i
<
10
Then
'如果i<10则条件成立
t
=
(t
+
1)
*
2
计算前一天桃子的个数
i
=
i
+
1
'再推前一天
Tao
(i)
'递归
End
If
End
Function
Private
Sub
Command1_Click()
t
=
1
Tao
(1)
'调用Tao
Print
t
'结果t=1534
End
Sub
option explicit
dim i as integer,t as integer
t=1
for i = 8 to 1 step -1
t = 2 * ( t + 1 )
next
print t
http://zhidao.baidu.com/question/76991927.html
这问题我已经回答过了~~你看看~