'ÀW¼Æ©M²Ö¿nÀW¼Æªºpºâ¤èªk
Option Explicit
'P(1 To ¦æ¼Æ¡A1 To ¦C¼Æ)¡Gì©l¸ê®Æ
'R(1 To 3¡A1 To ¤À¬q¼Æ)¡G
' R(1,...)«O¦s¬qÈ¡FR(2,...)«O¦sÀW¼Æ¡FR(3,...)«O¦s²Ö¿nÀW¼Æ
Public Sub Fre_Add(P, R)
Dim I As Integer, J As Integer, L As Integer
Dim M As Integer, N As Integer, Z As Integer
'®Ú¾Ú°}¦C¨D¤U¼Ðªº¤W¬É
'M¬O¼Æ¾Úªº¦æ¼Æ
'N¬O¼Æ¾Úªº¦C¼Æ
'Z¬O¸ê®Æªº¤À¬q¼Æ
M = UBound(P, 1): N = UBound(P, 2): Z = UBound(R, 2)
'pºâÀW¼Æ
For I = 1 To M
For J = 1 To N
For L = 1 To Z
If P(I, J) <= R(1, L) Then
'¸¨¤J°Ï¶¡½d³ò
R(2, L) = R(2, L) + 1
GoTo 100
End If
Next L
100: Next J
Next I
'pºâ²Ö¿nÀW¼Æ
For L = 1 To Z
R(3, L) = R(2, L)
Next L
For L = 2 To Z
R(3, L) = R(3, L) + R(3, L - 1)
Next L
End Sub |