- ©«¤l
- 2025
- ¥DÃD
- 13
- ºëµØ
- 0
- ¿n¤À
- 2053
- ÂI¦W
- 0
- §@·~¨t²Î
- WIN7
- ³nÅ骩¥»
- Office2007
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥x¥_¥«
- µù¥U®É¶¡
- 2011-3-2
- ³Ì«áµn¿ý
- 2024-3-14
|
¦^´_ 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¼Æ
-
|