- ©«¤l
- 835
- ¥DÃD
- 6
- ºëµØ
- 0
- ¿n¤À
- 915
- ÂI¦W
- 16
- §@·~¨t²Î
- Win 10,7
- ³nÅ骩¥»
- 2019,2013,2003
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-5-3
- ³Ì«áµn¿ý
- 2024-11-14
|
³Â·Ð¦U¦ì¤j¤jÀ°§Ú¸ÑÃD(§ÚÁÙ¬Oªì¾ÇªÌ T^T)
´N¬O¦³1~20ӼƦr¡A·QÀH¾÷¤À²Õ¦¨4²Õ
¥i½Ð¤j¤jÌ´£¨Ñ±zªº¼¶¼g¤è¦¡ ...
tray1203 µoªí©ó 2014-12-4 12:30 - Sub nn()
- Dim iI%, iJ%, iMax%, iGet% ' ©w¸q¾ã¼Æ
- Dim sStr$ ' ¦r¦ê
- Dim vA(), vT() ' °}¦C
-
- Randomize (Rnd) ' ªì©l¤Æ¶Ã¼Æ
- vA = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20) ' «Å§i°}¦C¥]§t¨CӼƦr (1~20)
- ReDim vT(4, 0) ' ³]©w¼Ðªº°}¦Cªºªì©l¤j¤p
- iMax = 20 ' 20 ӼƦr
- Do While iMax > 0 ' Do °j°é¶}©l,·íp¼ÆȤj©ó0«hÄ~Äò°õ¦æ°j°é
- For iI = 0 To 4 ' For °j°é¶}©l,¨C²Õ5ӼƦr(0 ~ 4, ¦@4²Õ)
- iGet = Int((iMax - iI - 1 + 1) * Rnd + 1) ' §ì¨ú¤UӼƦr
- vT(iI, UBound(vT, 2)) = vA(iGet - 1) ' ¦s¨ì¼Ðªº°}¦C
- For iJ = iGet To iMax - iI - 1
- vA(iJ - 1) = vA(iJ) ' ±N¸Ó¼Æ¦r¤§«áªº¤¸¯À¨Ì§Ç¶ñ¸É¤W¨Ó
- Next
- If UBound(vA) > 0 Then f ' If ±ø¥ó¦¡¶}©l(Y©|¥¼¨ì³Ì«á¤@ӼƦr)
- ReDim Preserve vA(UBound(vA) - 1) ' «h°}¦C¤¸¯À¼Æ¶q´î 1
- Else ' §_«h
- Erase vA ' ²M°£¸Ó°}¦C
- End If ' If ±ø¥ó¦¡µ²§ô
- Next ' For °j°éµ²§ô
- If UBound(vT, 2) < 3 Then ReDim Preserve vT(4, UBound(vT, 2) + 1) ' Y©|¥¼³B²z§¹¦¨, ¼Ðªº°}¦C·s¼W¦s©ñ¤U1²Õ5 (0 ~ 4)ӼƦrªºªÅ¶¡
- iMax = iMax - 5 ' p¼ÆÈ´î¥h1²Õªº¼Æ¶q (5)
- Loop ' Do °j°éµ²§ô
-
- sStr = "" ' ©³¤U±N¦U¤¸¯À¨Ì§Ç©ñ¤J sStr ÅܼƤº, ¥H«K«áÄòÅã¥ÜÀH¾÷¤À²Õµ²ªG¥Î
- For iMax = 0 To 3 ' 4²Õ³]¦r
- For iI = 0 To 4 ' ¨C²Õ5ӼƦr
- If sStr <> "" Then
- sStr = sStr & ", " & vT(iI, iMax) ' «Dº¦¸²K¥[¼Æ¦r, «e±¥[¤W , °µ¬°¼Æ¦rªº°Ï¹j
- Else
- sStr = vT(iI, iMax) ' º¦¸²K¥[¼Æ¦r, «e±¤£¥[ ,
- End If
- Next
- sStr = sStr & Chr(10) ' 1²Õ¼Æ¦r²K¥[§¹¦¨, ¥[¤W´«¦æ¦r¤¸
- Next
- MsgBox sStr
- End Sub
½Æ»s¥N½X |
|