- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¦^´_ 1# q1a2z5
¸Õ¸Õ¬Ý- Option Explicit
- Sub Ex() '¼Æ¦rªº«±Æ
- Dim w As String, i As Single, t As Single
- Dim ww As String, Ar(), Arr(), At(), tt As Single
- w = 66654422 '«ü©w¼Æ¦r
- t = Application.WorksheetFunction.Fact(Len(w)) 'Fact(¤u§@ªí¨ç¼Æ):¼Æ¦rªº¶¥¼¡C¬Y¼Æªº¶¥¼µ¥©ó 1*2*3*...* ¼Æ¦r
- '*******************************************
- t = t / 3 '666«½Æ
- t = t / 2 '44«½Æ
- t = t / 2 '22«½Æ
- t = t / 3 '2,4,6«½Æ
- '*******************************************
- ReDim At(1 To t) ' '³]¥ß«·s±Æ¦CªºÁ`¼Æªº°}¦C
- ReDim Ar(1 To Len(w))
- For i = 1 To Len(w)
- Ar(i) = Mid(w, i, 1) '¼Æ¦r«ü©w¨ì°}¦C¤¤
- Next
- '**********************************
- For i = 1 To UBound(At)
- ww = "" '²MªÅ
- Do
- Randomize 'ªì©l¤Æ¶Ã¼Æ²£¥Í¾¹
- Arr = Ar 'Ar(¼Æ¦r«ü©wªº°}¦C)¸m¤J Arr
- Do
- tt = Int(((Len(w)) * Rnd) + 1) '¶Ã¼Æ
- If Arr(tt) <> "" Then
- ww = ww & Arr(tt)
- Arr(tt) = "" '²MªÅ
- End If
- Loop Until Len(Join(Arr, "")) = 0 'Arr ¥þ³¡²MªÅ
- If InStr("," & Join(At, ",") & ",", "," & ww & ",") Then '¼Æ¦r¦s¦b"«·s±Æ¦CªºÁ`¼Æªº°}¦C
- ww = ""
- Else
- At(i) = ww
- Exit Do
- End If
- Loop
- Next
- [a1].Resize(t) = Application.WorksheetFunction.Transpose(At)
- End Sub
½Æ»s¥N½X |
|