- 最後登錄
- 2024-9-17
- 在線時間
- 37 小時
- 註冊時間
- 2009-9-18
- 閱讀權限
- 20
- 精華
- 0
- UID
- 7034376
- 帖子
- 73
- 積分
- 22 點
- 潛水值
- 8184 米
| 如果你忘記伊莉的密碼,請在登入時按右邊出現的 '找回密碼'。輸入相關資料後送出,系統就會把密碼寄到你的E-Mail。 有時候用遞迴寫真的方便很多- '全排列
- Private Sub Command1_Click()
- Dim a As String
- a = "123"
- Cls
- cal_1 a, "", String(Len(a), " ")
- End Sub
- Sub cal_1(a As String, s As String, k As String)
- Dim i As Integer, x As String
-
- If Len(s) = Len(a) Then Print s: Exit Sub
-
- For i = 1 To Len(a)
- If Mid$(k, i, 1) = " " Then
- x = k: Mid$(x, i, 1) = "*"
- cal_1 a, s & Mid(a, i, 1), x
- End If
- Next
- End Sub
- '6組號碼3星連碰
- Private Sub Command2_Click()
- Dim r() As String, s() As String, a As String
-
- a = "1 2 3 4 5 6"
- r = Split(a)
- Cls
- Call cal_2(r(), s(), 0, 0)
- End Sub
- Sub cal_2(r() As String, s() As String, p As Integer, t As Integer)
- If t = 3 Then Print Join(s, ","): Exit Sub
- For i = p To UBound(r)
- ReDim Preserve s(t): s(t) = r(i)
- Call cal_2(r(), s(), i + 1, t + 1)
- Next
- End Sub
- Private Sub Form_Load()
- AutoRedraw = True
- End Sub
複製代碼 ... |
|