Dim ans Private Sub Form_Load() Me.Hide Open App.Path & "\out.txt" For Output As #1 For i = 0 To 48 a = 2 ^ i ans = ans + a Next d = 0 For i = 48 To 63 e = "" For j = Len(a) To 1 Step -1 b = Val(Mid(a, j, 1)) c = b + b + d d = 0 If c >= 10 And j <> 1 Then d = c \ 10 c = c Mod 10 End If e = c & e Next a = e d = 0 e = "" Do If Len(a) < Len(ans) Then a = "0" & a If Len(ans) < Len(a) Then ans = "0" & ans Loop Until Len(ans) = Len(a) For j = Len(a) To 1 Step -1 b = Val(Mid(a, j, 1)) c = b + b + d d = 0 If c >= 10 And j <> 1 Then d = c \ 10 c = c Mod 10 End If e = c & e Next Next Print #1, e Close End End Sub
Dim ans
回覆刪除Private Sub Form_Load()
Me.Hide
Open App.Path & "\out.txt" For Output As #1
For i = 0 To 48
a = 2 ^ i
ans = ans + a
Next
d = 0
For i = 48 To 63
e = ""
For j = Len(a) To 1 Step -1
b = Val(Mid(a, j, 1))
c = b + b + d
d = 0
If c >= 10 And j <> 1 Then
d = c \ 10
c = c Mod 10
End If
e = c & e
Next
a = e
d = 0
e = ""
Do
If Len(a) < Len(ans) Then a = "0" & a
If Len(ans) < Len(a) Then ans = "0" & ans
Loop Until Len(ans) = Len(a)
For j = Len(a) To 1 Step -1
b = Val(Mid(a, j, 1))
c = b + b + d
d = 0
If c >= 10 And j <> 1 Then
d = c \ 10
c = c Mod 10
End If
e = c & e
Next
Next
Print #1, e
Close
End
End Sub
輸出是: 36893488147419103232