Private Sub Form_Load() Me.Hide Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Do Input #1, x Print #2, abc(x) Loop Until x = 0 Close Close End End Sub Function abc(t) If t = 1 Then ans = 0 If t = 2 Then ans = 1 If t > 2 Then ans = abc(t - 1) * 3 - abc(t - 2) abc = ans End Function
Private Sub Form_Load()
回覆刪除Me.Hide
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Do
Input #1, x
Print #2, abc(x)
Loop Until x = 0
Close
Close
End
End Sub
Function abc(t)
If t = 1 Then ans = 0
If t = 2 Then ans = 1
If t > 2 Then ans = abc(t - 1) * 3 - abc(t - 2)
abc = ans
End Function