ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ±Æ¦C²Õ¦XÃD¥Ø(1~10ªº©Ò¦³²Õ¦X)¦³¤j¤j¯à¯}¸Ñ¶Ü?

[µo°Ý] ±Æ¦C²Õ¦XÃD¥Ø(1~10ªº©Ò¦³²Õ¦X)¦³¤j¤j¯à¯}¸Ñ¶Ü?

¦U¦ì¥ý¶i¤j®a¦n
¤p§Ì³Ìªñ¦b¬ã¨s±Æ¦C²Õ¦X
·Q½Ð±Ð¦U¦ì¤j¤j
­Y·Q­n±q1~10­Ó¸¹½X¸Ì­±¶]§¹©Ò¦³ªº±Æ¦C²Õ¦X
10¨ú1~10¨ú10
¤@¦@·|²£¥Í¥X1,023­Ó²Õ¦X,ºâªk¦p¤U¤è
For I = 1 To 10
    x = x + Application.Combin(10, I)
Next
¦ý³o1,023­Ó²Õ¦X­n¦p¦ó¤~¯à²£¥Í¥X¨Ó©O?
½Ð°Ý­þ¦ì¤j¤j¦³¿ìªk¯}¸Ñ¶Ü?
PKKO

¤p§Ì´£¨Ñ©å¨£¡A¤U¦C¬O10¨ú4ªº¤è¦¡
¦ý­n¦p¦ó±q10¨ú1¨ì10¨ú10?
Á`¤£¯à¼g¤F¤U¤èªºµ{¦¡½X,µM«á¼g¤Q¹M§a= =?
  1. Sub ±Æ¦C²Õ¦X_¤£­«½Æ()
  2. Dim ar(), br(), x&, y&, z&, n&
  3. ReDim br(1 To Application.Combin(10, 4), 1 To 4)
  4. ReDim ar(1 To 10, 1 To 1)
  5. For i = 1 To 10
  6.     ar(i, 1) = i
  7. Next
  8. For w = 1 To UBound(ar) - 3
  9.     For x = w + 1 To UBound(ar) - 2
  10.         For y = x + 1 To UBound(ar) - 1
  11.             For z = y + 1 To UBound(ar)
  12.                 n = n + 1
  13.                 br(n, 1) = ar(w, 1)
  14.                 br(n, 2) = ar(x, 1)
  15.                 br(n, 3) = ar(y, 1)
  16.                 br(n, 4) = ar(z, 1)
  17.             Next
  18.         Next
  19.     Next
  20. Next
  21. Range("a2").Resize(n, 4) = br
  22. MsgBox "¾Þ§@§¹¦¨,¦@¥Í¦¨" & n & "­Ó²Õ¦X"
  23. End Sub
½Æ»s¥N½X
PKKO

TOP

¥»©«³Ì«á¥Ñ stillfish00 ©ó 2016-7-18 15:15 ½s¿è

¦^´_ 2# PKKO
1~1023 ¥Î¤G¶i¦ì¬Ý, ¦Ubit  bit=1¬°¨ú , bit=0¬°¤£¨ú
  1. Sub ListCombination()
  2.     Dim pools, poolCnt As Integer
  3.     pools = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
  4.     poolCnt = UBound(pools) - LBound(pools) + 1
  5.    
  6.     Dim i, j, arResult
  7.     ReDim arResult(1 To 2 ^ poolCnt - 1, 1 To 10)
  8.     For i = 1 To 2 ^ poolCnt - 1
  9.         For j = 0 To poolCnt - 1
  10.             If i And 2 ^ j Then arResult(i, j + 1) = pools(j)
  11.         Next
  12.     Next
  13.     Sheets.Add.[a1].Resize(UBound(arResult), UBound(arResult, 2)) = arResult
  14. End Sub
½Æ»s¥N½X
1

µû¤À¤H¼Æ

ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C

TOP

¦^´_ 3# stillfish00


    S¤j±z¦n,«D±`·PÁ±zªº¨ó§U
¤w¸g¦h¦¸±o¨ì±zªºÀ°¦£¡A·P¿E¤£ºÉ!
µ{¦¡½X¤p§Ì¥ý«ôŪ¤@¤U^_^
PKKO

TOP

¦^´_ 3# stillfish00
§ó¥¿¤@¤U
ReDim arResult(1 To 2 ^ poolCnt - 1, 1 To 10)
À³¸Ó¬°
ReDim arResult(1 To 2 ^ poolCnt - 1, 1 To poolCnt)
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C

TOP

¦^´_ 5# stillfish00


¨S°ÝÃD!
¨ºÃä¬O¹w¥ý«Ø¥ß©ñ¸m¸ê®Æªº°}¦C
·PÁ±zªº²Ó¤ß!
PKKO

TOP

        ÀR«ä¦Û¦b : ¤H­nª¾ºÖ¡B±¤ºÖ¡B¦A³yºÖ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD