- ©«¤l
- 228
- ¥DÃD
- 73
- ºëµØ
- 2
- ¿n¤À
- 333
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 10
- ³nÅ骩¥»
- Office 2000, 2019
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¹ü¤Æ¿¤
- µù¥U®É¶¡
- 2013-7-18
- ³Ì«áµn¿ý
- 2024-10-13
|
¦AÀu¤Æ- Option Explicit
- Option Base 1
- Option Compare Text
- Public Sub S_¤Gºû°}¦C§Ö³t´¡¤Jéw»¼¼W±Æ§Ç_01(ByRef ì©l¤Gºû°}¦C As Variant, ByVal ±Æ§Çºû«× As Long, ByVal ±Æ§ÇÁäÈ As Long, ByVal °_ As Long, ByVal ¨´ As Long)
- On Error Resume Next
-
- If °_ >= ¨´ Then
- Exit Sub
- End If
-
- '------------------------------------------------------
-
- Dim X As Long
- Dim Y As Long
-
- Dim Â^¨ú¦¨¤@ºû°}¦C As Variant
- Dim ¯Á¤Þ°}¦C() As Long
-
- '------------------------------------------------------
-
- ReDim Â^¨ú¦¨¤@ºû°}¦C(°_ To ¨´) As Variant
- ReDim ¯Á¤Þ°}¦C(°_ To ¨´) As Long
-
- If ±Æ§Çºû«× = 1 Then
- For X = °_ To ¨´
- Â^¨ú¦¨¤@ºû°}¦C(X) = ì©l¤Gºû°}¦C(X, ±Æ§ÇÁäÈ)
- ¯Á¤Þ°}¦C(X) = X
- Next X
- Else
- For Y = °_ To ¨´
- Â^¨ú¦¨¤@ºû°}¦C(Y) = ì©l¤Gºû°}¦C(±Æ§ÇÁäÈ, Y)
- ¯Á¤Þ°}¦C(Y) = Y
- Next Y
- End If
-
- '------------------------------------------------------
-
- ¤Gºû°}¦C§Ö³t´¡¤Jéw»¼¼W±Æ§Ç Â^¨ú¦¨¤@ºû°}¦C, ¯Á¤Þ°}¦C, °_, ¨´
-
- '------------------------------------------------------
-
- Dim ½Æ»sì©l¤Gºû°}¦C As Variant
-
- ½Æ»sì©l¤Gºû°}¦C = ì©l¤Gºû°}¦C
-
- If ±Æ§Çºû«× = 1 Then
- For X = °_ To ¨´
- For Y = LBound(ì©l¤Gºû°}¦C, 2) To UBound(ì©l¤Gºû°}¦C, 2)
- ì©l¤Gºû°}¦C(X, Y) = ½Æ»sì©l¤Gºû°}¦C(¯Á¤Þ°}¦C(X), Y)
- Next Y
- Next X
- Else
- For Y = °_ To ¨´
- For X = LBound(ì©l¤Gºû°}¦C, 1) To UBound(ì©l¤Gºû°}¦C, 1)
- ì©l¤Gºû°}¦C(X, Y) = ½Æ»sì©l¤Gºû°}¦C(X, ¯Á¤Þ°}¦C(Y))
- Next X
- Next Y
- End If
- End Sub
- Public Sub ¤Gºû°}¦C§Ö³t´¡¤Jéw»¼¼W±Æ§Ç(ByRef ì©l¤@ºû°}¦C As Variant, ByRef ¯Á¤Þ°}¦C() As Long, ByVal °_ As Long, ByVal ¨´ As Long)
- On Error Resume Next
-
- If °_ >= ¨´ Then
- Exit Sub
- End If
-
- '------------------------------------------------------
-
- Dim X As Long
- Dim Y As Long
- Dim S As Long
- Dim M As Long
- Dim E As Long
- Dim N As Long
-
- Dim ¼È¦s As Variant
- Dim ¯Á¤Þ¼È¦s As Long
-
- '------------------------------------------------------
-
- If ¨´ - °_ < 16 Then
- Dim ÁÙì°}¦C As Variant
-
- ReDim ÁÙì°}¦C(°_ To ¨´) As Variant
-
- For X = °_ To ¨´
- ÁÙì°}¦C(X) = ì©l¤@ºû°}¦C(¯Á¤Þ°}¦C(X))
- Next X
-
- For X = °_ + 1 To ¨´
- ¼È¦s = ÁÙì°}¦C(X)
- ¯Á¤Þ¼È¦s = ¯Á¤Þ°}¦C(X)
-
- For Y = X - 1 To °_ Step -1
- If ¼È¦s >= ÁÙì°}¦C(Y) Then
- Exit For
- End If
-
- ÁÙì°}¦C(Y + 1) = ÁÙì°}¦C(Y)
- ¯Á¤Þ°}¦C(Y + 1) = ¯Á¤Þ°}¦C(Y)
- Next Y
-
- ÁÙì°}¦C(Y + 1) = ¼È¦s
- ¯Á¤Þ°}¦C(Y + 1) = ¯Á¤Þ¼È¦s
- Next X
- Else
- Dim °ò·Ç As Variant
- Dim °ò·Ç°}¦C(3) As Variant
-
- °ò·Ç°}¦C(1) = ì©l¤@ºû°}¦C(¯Á¤Þ°}¦C(°_))
- °ò·Ç°}¦C(2) = ì©l¤@ºû°}¦C(¯Á¤Þ°}¦C((°_ + ¨´) \ 2))
- °ò·Ç°}¦C(3) = ì©l¤@ºû°}¦C(¯Á¤Þ°}¦C(¨´))
-
- For X = 2 To 3
- ¼È¦s = °ò·Ç°}¦C(X)
-
- For Y = X - 1 To 1 Step -1
- If ¼È¦s >= °ò·Ç°}¦C(Y) Then
- Exit For
- End If
-
- °ò·Ç°}¦C(Y + 1) = °ò·Ç°}¦C(Y)
- Next Y
-
- °ò·Ç°}¦C(Y + 1) = ¼È¦s
- Next X
-
- °ò·Ç = °ò·Ç°}¦C(2)
-
- '------------------------------------------------------
-
- Dim ¯Á¤Þ°_°}¦C() As Long
- Dim ¯Á¤Þ°ò°}¦C() As Long
- Dim ¯Á¤Þ¨´°}¦C() As Long
-
- ReDim ¯Á¤Þ°_°}¦C(¨´ - °_) As Long
- ReDim ¯Á¤Þ°ò°}¦C(¨´ - °_ + 1) As Long
- ReDim ¯Á¤Þ¨´°}¦C(¨´ - °_) As Long
-
- S = 0
- M = 0
- E = 0
- For X = °_ To ¨´
- ¯Á¤Þ¼È¦s = ¯Á¤Þ°}¦C(X)
- ¼È¦s = ì©l¤@ºû°}¦C(¯Á¤Þ¼È¦s)
-
- If ¼È¦s < °ò·Ç Then
- S = S + 1
- ¯Á¤Þ°_°}¦C(S) = ¯Á¤Þ¼È¦s
- ElseIf ¼È¦s = °ò·Ç Then
- M = M + 1
- ¯Á¤Þ°ò°}¦C(M) = ¯Á¤Þ¼È¦s
- Else
- E = E + 1
- ¯Á¤Þ¨´°}¦C(E) = ¯Á¤Þ¼È¦s
- End If
- Next X
-
- '------------------------------------------------------
-
- If S > 1 Then
- ¤Gºû°}¦C§Ö³t´¡¤Jéw»¼¼W±Æ§Ç ì©l¤@ºû°}¦C, ¯Á¤Þ°_°}¦C, 1, S
- End If
-
- If E > 1 Then
- ¤Gºû°}¦C§Ö³t´¡¤Jéw»¼¼W±Æ§Ç ì©l¤@ºû°}¦C, ¯Á¤Þ¨´°}¦C, 1, E
- End If
-
- '------------------------------------------------------
-
- N = °_ - 1
- For X = 1 To S
- N = N + 1
- ¯Á¤Þ°}¦C(N) = ¯Á¤Þ°_°}¦C(X)
- Next X
-
- For X = 1 To M
- N = N + 1
- ¯Á¤Þ°}¦C(N) = ¯Á¤Þ°ò°}¦C(X)
- Next X
-
- For X = 1 To E
- N = N + 1
- ¯Á¤Þ°}¦C(N) = ¯Á¤Þ¨´°}¦C(X)
- Next X
- End If
- End Sub
½Æ»s¥N½X ±Æ§Ç°}¦C¡G10000 x 2 ªº¾ã¼Æ¡]¦ý§Úªº¤Þ¼Æ¥N½X¬OVariant¡^
1.¤£«½Æ¼Æ¦r¡G¶¶§Ç¡÷°õ¦æ100¦¸Á`¦X¡÷7.598¬í
¡@¡@¡@¡@¡@¡@¡@°f§Ç¡÷°õ¦æ100¦¸Á`¦X¡÷9.393¬í
¡@¡@¡@¡@¡@¡@¡@¶Ã§Ç¡÷°õ¦æ100¦¸Á`¦X¡÷9.462¬í
2.«½Æ¼Æ¦r¡G¶¶§Ç¡÷°õ¦æ100¦¸Á`¦X¡÷5.176¬í
¡@¡@¡@¡@¡@¡@°f§Ç¡÷°õ¦æ100¦¸Á`¦X¡÷5.517¬í
¡@¡@¡@¡@¡@¡@¶Ã§Ç¡÷°õ¦æ100¦¸Á`¦X¡÷5.89¬í
¡]«½Æ¼Æ¦r¤j·§¦b5~20Ó¤§¶¡¡^
¦ôp«½Æ¤£«½Æ¼vÅT¸û¤j¡A¶¶§Ç¸û§Ö¡A¥i¯à¬O´¡¤J±Æ§Çªº¼vÅT¡A°f§Ç¤Î¶Ã§Ç¬Û®t¤£¤j¡C
²z½×¤W®É¶¡¡G¡]¤£ª¾¥¿¤£¥¿½T¡^
´¡¤J±Æ§Ç¡G¶¶§Ç<¶Ã§Ç<°f§Ç¡A«½Æ<¤£«½Æ
¤@¯ëªº§Ö³téw±Æ§Ç¡G¶¶§Ç<¶Ã§Ç¡Ü°f§Ç¡A¤£«½Æ<«½Æ
§Úªº§Ö³t´¡¤Jéw±Æ§Ç¡G¶¶§Ç<°f§Ç¡Ü¶Ã§Ç¡A«½Æ<¤£«½Æ |
|