Dim linee(100) As Integer Private Sub Form_Load() Me.Hide Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Input #1, num linee(0) = 3 For i = 0 To 100 If i <> 0 Then linee(i) = linee(i - 1) + 2 If linee(i) >= num Then Print #2, i + 1: Exit For Next Close #2 Close #1 End End Sub
Dim x, y As Integer Private Sub Form_Load() Me.Hide Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Input #1, x Input #1, y Do If x < y Then Exit Do Else i = i + 1 x = x \ y End If Loop Print #2, i Close #2 Close #1 End End Sub
Dim num() As Integer Private Sub Form_Load() Me.Hide Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Input #1, n: r = 0 Do ReDim Preserve num(r) If r = 0 Then num(0) = 3 Else num(r) = num(r - 1) + 2 End If r = r + 1 Loop Until num(r - 1) >= Val(n) Print #2, r Close #2 Close #1 End End Sub
Dim linee(100) As Integer
回覆刪除Private Sub Form_Load()
Me.Hide
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Input #1, num
linee(0) = 3
For i = 0 To 100
If i <> 0 Then linee(i) = linee(i - 1) + 2
If linee(i) >= num Then Print #2, i + 1: Exit For
Next
Close #2
Close #1
End
End Sub
作者已經移除這則留言。
回覆刪除Dim x, y As Integer
回覆刪除Private Sub Form_Load()
Me.Hide
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Input #1, x
Input #1, y
Do
If x < y Then
Exit Do
Else
i = i + 1
x = x \ y
End If
Loop
Print #2, i
Close #2
Close #1
End
End Sub
Dim num() As Integer
回覆刪除Private Sub Form_Load()
Me.Hide
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Input #1, n: r = 0
Do
ReDim Preserve num(r)
If r = 0 Then
num(0) = 3
Else
num(r) = num(r - 1) + 2
End If
r = r + 1
Loop Until num(r - 1) >= Val(n)
Print #2, r
Close #2
Close #1
End
End Sub