回覆列表
  • 1 # 使用者4038238679905

    13680種,EXCEL中用程式跑遍所有情況,剔除不符的。 EXCEL裡,選單——工具——宏——V…B…編輯器 在編輯器介面,選單——插入——模組 在模組1裡貼上如下程式碼: Sub Macro1() Range("A1").Select Dim i1, i2, i3, i4, i5, i6, n, k, p, q, flag Dim tstr, nstr, dbstr Dim tshuzu(7) n = 0 For i1 = 1 To 6 For i2 = 1 To 6 For i3 = 1 To 6 For i4 = 1 To 6 For i5 = 1 To 6 For i6 = 1 To 6 tstr = i1 & i2 & i3 & i4 & i5 & i6 flag = 1 For k = 1 To 6 If InStr(tstr, 11 * k) <> 0 Then flag = 0 Exit For End If Next If InStr(tstr, "16") <> 0 Or InStr(tstr, "61") <> 0 Then flag = 0 End If If flag = 1 Then tshuzu(1) = i1 tshuzu(2) = i2 tshuzu(3) = i3 tshuzu(4) = i4 tshuzu(5) = i5 tshuzu(6) = i6 For p = 1 To 5 For q = p + 1 To 6 If tshuzu(p) > tshuzu(q) Then t = tshuzu(p) tshuzu(p) = tshuzu(q) tshuzu(q) = t End If Next Next nstr = tshuzu(1) & tshuzu(2) & tshuzu(3) & tshuzu(4) & tshuzu(5) & tshuzu(6) For k = 1 To 6 If InStr(nstr, 1111 * k) <> 0 Then flag = 0 Exit For End If Next dbstr = "" For k = 1 To 6 If InStr(dbstr, tshuzu(k)) = 0 Then dbstr = dbstr & tshuzu(k) End If Next If Len(dbstr) < 3 Then flag = 0 End If End If If flag = 1 Then n = n + 1 Range("A1") = n Range("B" & n) = tstr End If Next Next Next Next Next Next Range("A2").Select Range("A2") = "Finish" End Sub 儲存後回EXCEL介面——選單——工具——宏——宏——執行。 執行宏“Macro1”,得到結果。

  • 中秋節和大豐收的關聯?
  • 爸爸媽媽辛苦了原唱?