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

[µo°Ý] VBA¼Æ¦r¾ã¦X¦b¤@°_

Sub GO_______________()

MsgBox Join(¼Æ¦rÂkÃþ(Array(246517, 246518, 246519), 1), vbCrLf)
MsgBox Join(¼Æ¦rÂkÃþ(Array(246299, 246217, 246517, 246518, 246519), 2), vbCrLf)


End Sub



Public Function ¼Æ¦rÂkÃþ(NumAR, ByVal ¦ì¼Æ As Long)
' ¦ì¼Æ need >= 0

Set c_max = CreateObject("Scripting.Dictionary")
Set c_min = CreateObject("Scripting.Dictionary")

For Each n In NumAR
     root = n \ (10 ^ ¦ì¼Æ)
     n = n Mod (10 ^ ¦ì¼Æ)
     If Not c_max.exists(root) Then
            c_max(root) = n
            c_min(root) = n
     End If
     If n > c_max(root) Then c_max(root) = n
     If n < c_min(root) Then c_min(root) = n
Next


For Each root In c_max
     c_max(root) = root & "(" & c_min(root) & "-" & c_max(root) & ")"
Next

¼Æ¦rÂkÃþ = c_max.items

End Function

TOP

        ÀR«ä¦Û¦b : ¤Hªº²´·úªø¦b«e­±¡A¥u¬Ý¨ì§O¤Hªº¯ÊÂI¡Aµ·²@¬Ý¤£¨ì¦Û¤vªº¯ÊÂI¡C
ªð¦^¦Cªí ¤W¤@¥DÃD