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 x = x / 2 a = x * (x - 1) Do x = x / 2 a = a + x Loop Until x = 1 a = a + 1 Print #2, a Close Close End End Sub
Private Sub Form_Load() Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Input #1, x a = Val(x) / 2 * (Val(x) / 2 - 1): b = Val(x) / 4: c = b Do c = c / 2 ans = ans + c Loop Until c = 1 ans = ans + 1 + a + b Print #2, ans Close #2 Close #1 End End Sub
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
x = x / 2
a = x * (x - 1)
Do
x = x / 2
a = a + x
Loop Until x = 1
a = a + 1
Print #2, a
Close
Close
End
End Sub
Private Sub Form_Load()
回覆刪除Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Input #1, x
a = Val(x) / 2 * (Val(x) / 2 - 1): b = Val(x) / 4: c = b
Do
c = c / 2
ans = ans + c
Loop Until c = 1
ans = ans + 1 + a + b
Print #2, ans
Close #2
Close #1
End
End Sub