Dim linee(100) 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, music, linenum linee(0) = linenum For i = 0 To 100 If i <> 0 Then linee(i) = linee(i - 1) + (linenum - 1) If linee(i) >= music 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, x, n Do ReDim Preserve num(r) If r = 0 Then num(0) = Val(x) 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)
回覆刪除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, music, linenum
linee(0) = linenum
For i = 0 To 100
If i <> 0 Then linee(i) = linee(i - 1) + (linenum - 1)
If linee(i) >= music 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, x, n
Do
ReDim Preserve num(r)
If r = 0 Then
num(0) = Val(x)
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