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

[µo°Ý] ¦b¤è°}©Î¯x°}¤¤,¥H±ÛÂà¤è¦¡¶ñ¤J­È

[µo°Ý] ¦b¤è°}©Î¯x°}¤¤,¥H±ÛÂà¤è¦¡¶ñ¤J­È

¥»©«³Ì«á¥Ñ ­ã´£³¡ªL ©ó 2015-10-27 14:50 ½s¿è

¦b¤è°}©Î¯x°}¤¤,¥H±ÛÂà¤è¦¡¶ñ¤J­È

¢°¡D³]¤@­Ó¤è°}©Î¯x°}¬°5*5¡]¶·¦Ò¼{¥i¯à§ïÅܬ°7*7,9*9...)¡C
¢±¡D¥ô¿ï¤@­ÓÀx¦s®æ¬°¡e¤¤¤ßÂI¡f¡A¥H¦¹¤¤¤ßÂI¨Ì¡e¶¶®É°w¡f¤è¦V¡A¡e¥Ñ¤º¦Ó¥~¡f¶ñ¤J­È¡C

»Ý¨D®ÄªG¢°¡G¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@»Ý¨D®ÄªG¢±¡G
A999.gif ¡@¡@¡@¡@ B999.gif
¡@
´M¨DVBA¥ô¦ó¸Ñªk¡A
­Ó¤H¥u·|¡e¥|½ü©w¦ì¡fªk¡A¬°ÁקK¤j®a¦³¥ý¤J¬°¥Dªº¬Ýªk¡A¼È¤£´£¨Ñµ{¦¡½X¡F

§Æ±æ¸ô¹L¤j¤j¤£§[´£¨Ñ§ó¦h¤èªk¡A
¥ý¦¹Á¹L¡ã¡ã
¡@
¡×¡×¡×2015.10.27 ¸É¥R¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×
µ{¦¡½X½Ð¨£¢°¢³¡ã¢°¢µ¼Ó¡A
¥H«D±M·~¦Û¾ÇªÌ¦Ó¨¥¡A¥u·|¥Î³Ì°ò¥»ªºÀx¦s®æ§PÂ_¡A©Ò¥H¹ïªì¾ÇªÌ¤]À³®e©ö¬ÝÀ´¡A

¦Ó¨ä¥¦¤j¤jªºµ{¦¡½X¡A¹ê¬°¥¿³Wªº¸Ñªk¡A§ó¦³°Ñ¦Ò»ù­È¡A
¦A«×ÁÂÁ¦U¦ì°Ñ»Pªº¤j¤j­Ì¡ã¡ã

ªþ¥ó¤U¸ü¡G
20151027-01(±ÛÂà¯x°}).rar (13.38 KB)
¡@

  1. Option Base 1
  2. Sub ¥H±ÛÂà¤è¦¡¶ñ¤J­È()

  3.     xc = 10: yc = 10 '¤¤¤ß¦ì¸m

  4.     ¥k = [{0, 1}]: ¤U = [{1,0}]: ¥ª = [{0,-1}]: ¤W = [{-1, 0}]
  5.     yx = Application.Transpose(Application.Transpose(Array(¥k, ¤U, ¥ª, ¤W))) '±±¨î¤è¦V¤ÎÂà¦V
  6.    
  7.     n = InputBox("¿é¤J±Æ¦C¼Æ¦r", , 25)
  8.     n1 = Application.RoundUp(((n ^ 0.5) - 1) / 2, 0) + 1
  9.     nn = n1 * 2 + 1
  10.     Cells(yc - n1, xc - n1).Resize(nn, nn).ClearContents

  11.     x = xc: y = yc
  12.     Cells(xc, yc) = 1
  13.     For i = 2 To n
  14.         ds = [{0,0,0,0}]
  15.         For j = 1 To 4 '¥|­Ó¤è¦V
  16.             If Cells(y + yx(j, 1), x + yx(j, 2)) = "" Then
  17.                 ds(j) = ((y + yx(j, 1) - yc) ^ 2 + (x + yx(j, 2) - xc) ^ 2) * 10 + j '¶ZÂ÷*10+¤è¦V
  18.             Else
  19.                 ds(j) = ""
  20.             End If
  21.         Next
  22.         jj = Application.Min(ds) Mod 10 '¨ú¶ZÂ÷­ìÂI³Ìµu¤Î±Æ¦C³Ì«e¤è¦V
  23.         x = x + yx(jj, 2)
  24.         y = y + yx(jj, 1)
  25.         Cells(y, x) = i
  26.     Next
  27. End Sub
½Æ»s¥N½X
1

µû¤À¤H¼Æ

{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¦^´_ 2# ML089


´N¬O¨ØªAªO¥Dªº¼Æ¾Ç¥\¤O¡I
³oÃD¬O¤§«eª¾ÃÑ+¸Ñ¹Lªº°ÝÃD¡Aı±o¼Æ¾Ç¤Ó½ÆÂø¡A®Ú¥»·Q¤£¥X³o­Ó¤èªk¡A¥u¯à¯Âºé¥HRange¤èªk¥h¶]¡ã¡ã
ÁÂÁªO¥Dªºµ¹¤O¡ã¡ã

TOP

¦^´_ 3# ­ã´£³¡ªL

ª¾ÃÑ+ªºW¤j¥Î¼Æ¾Ç¤Î¨ç¼Æªº¥\¤O¯u¬OµL¤H¯à¼Ä¡A­ì¥ý¤@¶}©l§Ú¤]¬O´Â³o¤è¦Vºc·Q¡C

«á¨Ó¬Ý§A¶Kªº®ÄªG¹Ï¦b­þ¸ÌÂà°ÚÂà°Ú¡A¬ðµM·Q¨ì¬JµM­n¥ÎVBA´N¦³¥þ·sªººc·Q¡C
±q¶K¹Ïªº¹B°Ê¼Ò¦¡¥i¥H¾ã²z¦p¤U
1. ¨C¤@¨B¥u¦³ ¤W¡B¤U¡B¥ª¡B¥k µ¥4ºØ¨Bªk
2. ­n³ò¶¤¤¤ß±Æ¦C¡A©Ò¥H¨C¤@¨B³£­n¿ï¾ÜÂ÷¤¤¤ß³Ìªñªº¶ZÂ÷¡C

'±±¨î¤è¦V¤ÎÂà¦V  
yx = Application.Transpose(Application.Transpose(Array(¥k, ¤U, ¥ª, ¤W))) '²Ä¤@¨B¦V¥k¡A¶¶®É±Æ¦C
¹Ï¤ù 1.jpg
§Q¥Î¤W¦¡¤¤ ... ¥k, ¤U, ¥ª, ¤W ªº©ñ¸m¶¶§Ç¨Ó±±¨î¤è¦V¤ÎÂà¦V
²Ä1¦ì¸m±±¨î²Ä¤@¨B¤è¦V¡A¥i¥H©ñ¸m ..... ¥k, ¤U, ¥ª, ¤W .... ¨Ó§ïÅÜ¡C
²Ä2~3¦ì¸m±±¨î¶¶¡B°f±Æ¦C¤è¦V¡C

yx = Application.Transpose(Application.Transpose(Array(¤U, ¥k, ¤W, ¥ª)))  '²Ä¤@¨B¦V¤U¡A°f®É±Æ¦C
¹Ï¤ù 2.jpg

¥u¯à¼g¨Ç²³æVBA¡A¤¶­±¤Î»yªk¦³¤£¨¬ªº¦a¤èÅwªï¤j®aÄ~Äò­×§ï¡C
1

µû¤À¤H¼Æ

{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¥»©«³Ì«á¥Ñ no3-taco ©ó 2015-10-25 19:34 ½s¿è

¨S¦³¼g±o«Üºë¹ê¡A¦ý¬Oµ²ªG¬O¤@¼Ëªº
ps:»Ý¥ýÂI¿ï¤@­Ó¨¬°÷¶ñº¡ªºÀx¦s®æ
  1. Sub testarr()  '±q³o¸Ì°õ¦æ
  2. arrX 7, 1  '7¶¥ ,¼Æ¦Cªì©l­È
  3. End Sub

  4. Sub arrX(numX&, k&)
  5. Dim cx&, cy&
  6. arr = Array(0, 1, 0, -1, 0, 1)
  7. If numX <> 1 Then
  8. arrX numX - 2, k
  9.     p = (numX - 1) / 2
  10.     For i = 1 To 4
  11.         For j = 0 To numX - 2
  12.             k = k + 1
  13.             cx = ActiveCell.Row + p * arr(i - 1) + arr(i) * j - arr(i) * (p - 1)
  14.             cy = ActiveCell.Column + p * arr(i) + arr(i + 1) * j - arr(i + 1) * (p - 1)
  15.             Cells(cx, cy) = k
  16.         Next j
  17.     Next i
  18.     p = p + 1
  19. Else
  20.     ActiveCell = k
  21. End If
  22. End Sub
½Æ»s¥N½X
2

µû¤À¤H¼Æ

TOP

¦^´_ 5# no3-taco


³o¬O§Ú§¹¥þ¤£¥i¯à¥h·Qªº¤è¦¡, ¯u¬O ¦Ñ¤â + °ª¤â,
´ú¸Õ§¹¥þ²Å¦X,
ÁÂÁ±zªº°Ñ»P¤Î´£¨Ñª¾Ãѵ²´¹~~

TOP

¦^´_ 6# ­ã´£³¡ªL

p = p + 1 '­×§ï®É§Ñ°O®³±¼

§Ú¤£¬O¦Ñ¤â¡A¥u¬O­è­è½m²ß¼g¥¿¦n¦³¼g¥X¨Ó

TOP

¦^´_ 7# no3-taco


¡ã¡ã¥u¬O­è­è½m²ß¼g¡e¥¿¦n¡f¦³¼g¥X¨Ó¡ã¡ã¡@

¨º´N§ó¤£Â²³æ¡A§Ú¬O¸£¯«¸g§ÖÂण¹L¨Ó¤F¡I
³oÃD¥»¥H¬°¤£·|¦³¤HÃöª`¡A¨S·Q¨ìÁÙ¬O±o¨ì¨â­Ó¤£¦P¸Ñªk¡A¯u¬O·P¿E±z­ÌªºÃöª`¡I
Ä~Äò´Á«Ý¨ä¥¦¸Ñªk¡I¡I

»Ý¨Dµ²ªG¢±¤]¥i¦A·Q·Q¡ã¡ã

TOP

¥»©«³Ì«á¥Ñ bobomi ©ó 2015-10-25 22:27 ½s¿è

Sub q77()

  Cells.Clear
   
'**** ¤W¡B¤U¡B¥ª¡B¥k  copy from  ML089 ****
  ¥k = [{0, 1, "¡÷","¢z"}]: ¤U = [{1,0,"¡õ","¢{"}]: ¥ª = [{0,-1,"¡ö","¢}"}]: ¤W = [{-1, 0,"¡ô","¢|"}]
  
  yx = Array(¥k, ¤U, ¥ª, ¤W)

  r = 10
  c = 10
  Value = 1
  Cells(r, c) = Value
  For Count = 1 To  6^2
  rc = yx(¤è¦V Mod 4)
  n = CLng(Count / 2 + 0.001)
  For Repeat = 1 To n
      r = r + rc(1)
      c = c + rc(2)
      Value = Value + 1
      If Repeat = n Then
         Cells(r, c) = yx((¤è¦V + 1) Mod 4)(4) & " " & Value
      Else
         Cells(r, c) = rc(3) & " " & Value
      End If
  Next
  ¤è¦V = ¤è¦V + 1
  Next


' ³Ì«á ¡· ¡´ ³o2²Å¸¹½Ð¦Û¤v³B²z

End Sub
2

µû¤À¤H¼Æ

    • ­ã´£³¡ªL: ºë«~¤å³¹¡A¤]¬O­È±o°Ñ¦Ò¦n¦¡ª÷¿ú + 5
    • ML089: ºë«~¤å³¹¡A²Ä¤@­Ó¹F°}ªº¡Cª÷¿ú + 5

TOP

¦^´_ 9# bobomi

¥[¤J bobomi ªº
¥k = [{0, 1, "¡÷","¢z"}]: ¤U = [{1,0,"¡õ","¢{"}]: ¥ª = [{0,-1,"¡ö","¢}"}]: ¤W = [{-1, 0,"¡ô","¢|"}]
®ÄªG¹Ï¤G´N¥X¨Ó¤F

Option Base 1
Sub ¥H±ÛÂà¤è¦¡¶ñ¤J­È()

    xc = 10: yc = 10    '¤¤¤ß¦ì¸m

    ¥k = [{0, 1, "¡÷","¢z"}]: ¤U = [{1,0,"¡õ","¢{"}]: ¥ª = [{0,-1,"¡ö","¢}"}]: ¤W = [{-1, 0,"¡ô","¢|"}]
    yx = Array(¥k, ¤U, ¥ª, ¤W)    '±±¨î¤è¦V¤Î¶¶®ÉÂà¦V

    '    ¥k = [{0, 1, "¡÷","¢|"}]: ¤U = [{1,0,"¡õ","¢z"}]: ¥ª = [{0,-1,"¡ö","¢{"}]: ¤W = [{-1, 0,"¡ô","¢}"}]
    '    yx = Array(¤U, ¥k, ¤W, ¥ª)    '±±¨î¤è¦V¤Î°f®ÉÂà¦V

    n = InputBox("¿é¤J±Æ¦C¼Æ¦r", , 25)
    [A1:Z26].ClearContents

    x = xc: y = yc: xp1 = x: yp1 = y
    Cells(x, y) = 1
    f1 = "": f2 = ""
    For i = 2 To n
        ds = [{"","","",""}]
        For j = 1 To 4    '¥|­Ó¤è¦V
            yy = yx(j)(1): xx = yx(j)(2)
            If Cells(y + yy, x + xx) = "" Then
                ds(j) = ((y + yy - yc) ^ 2 + (x + xx - xc) ^ 2) * 10 + j    '¶ZÂ÷*10+¤è¦V
            End If
        Next
        k = Application.Min(ds) Mod 10    '¨ú¶ZÂ÷­ìÂI³Ìµu¤Î±Æ¦C³Ì«e¤è¦V

        y = y + yx(k)(1)
        x = x + yx(k)(2)
        Cells(y, x) = i

        ¤è¦V²Å¸¹ = IIf(i = 2, "¡·", yx(k)(3 + IIf(k = kp1, 0, 1)))
        Cells(yp1, xp1) = Cells(yp1, xp1) & ¤è¦V²Å¸¹
        yp1 = y: xp1 = x: kp1 = k

        'Application.Wait TimeSerial(Hour(Now()), Minute(Now()), Second(Now()) + 1)
    Next
    Cells(yp1, xp1) = Cells(yp1, xp1) & "¡´"
End Sub
1

µû¤À¤H¼Æ

{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

        ÀR«ä¦Û¦b : ¯àµ½¥Î®É¶¡ªº¤H¡A¥²¯à´x´¤¦Û¤v§V¤Oªº¤è¦V¡C
ªð¦^¦Cªí ¤W¤@¥DÃD