B + P10(N-1) 。。。。。。。。。。。1/2*P10(N-1)
A B +P10(N-2) 。。。。。。。。。。。。1/4*P10(N-2)
A A B +P10(N-3)。。。。。。。。。。。。1/8*P10(N-3)
A A A B +P10(N-4)。。。。。。。。。。。1/16*P10(N-4)
A A A A B + P10(N-5)。。。。。。。。。 1/32*P10(N-5)
A A A A A +P5(N-5)。。。。。。。。。。 1/32*P5(N-5)
Dim NN As Integer = 63
Dim NB(NN) As Integer
Dim X As Double
Dim I As Integer
Dim J As Integer
Dim K As Integer
Dim N As Integer
Dim MM As Integer = 20000000
Randomize()
N = 0
For I = 1 To MM
For J = 0 To NN
X = Rnd()
If X > 0.5 Then
NB(J) = 1
Else
NB(J) = 0
End If
Next
For J = 0 To NN - 4
For K = 0 To 4
If NB(J + K) = 0 Then
GoTo NXJ
End If
Next
N = N + 1
GoTo NXI
NXJ:
Next
NXI:
Next
X = N / MM
Me.Label1.Text = Format(X, "##.####%")
Dim NN As Integer = 63
Dim NB(NN) As Integer
Dim X As Double
Dim I As Integer
Dim J As Integer
Dim K As Integer
Dim L As Integer
Dim N As Integer
Dim MM As Integer = 20000000
Randomize()
N = 0
For I = 1 To MM
For J = 0 To NN
X = Rnd()
If X > 0.5 Then
NB(J) = 1
Else
NB(J) = 0
End If
Next
J = -1
NXJ:
J = J + 1
If J + 4 > NN Then GoTo NXI
For K = 0 To 4
If NB(J + K) = 0 Then
GoTo NXJ
End If
Next
J = J + 4
NXJ2:
J = J + 1
If J + 4 > NN Then GoTo NXI
For K = 0 To 4
If NB(J + K) = 0 Then
GoTo NXJ2
End If
Next
N = N + 1
NXI:
Next
X = N / MM
Me.Label1.Text = Format(X, "##.####%")