ÀÌ·¸°Ô ¼Ò½ºÄÚµùÇØ º¸¼¼¿ä.
¾ÈµÇ¸é ÀÔ·ÂÆÄÀÏÀ» ¸ÞÀÏ·Î º¸³»Áֽñ⠹ٶø´Ï´Ù. ^^
Option Explicit
Sub main()
''Çʼö º¯¼ö ¼±¾ð Dim Àμö1, Àμö2, i, ¹öÆÛ As Variant ''ÇÙ½É º¯¼ö ¼±¾ð Dim ¿Â÷ÄÚµå, ¿ùÀÌ¿ëȽ¼ö, ¿©Çà°Å¸®, ž½ÂÀοø, ÇÕ°è(1000), Á¼®ÄÚµå(1000), °í°´¹øÈ£(1000), j, Temp, Num As Variant ''Àμö ó¸® Àμö1 = Val(Left(Command, InStr(Command, " "))) Àμö2 = Val(Mid(Command, InStr(Command, " "))) ''ÀÔ·Â ÆÄÀÏ Ã³¸® Open "c:\c_it\data\abc015.txt" For Input As #1 For i = 1 To Àμö2 Line Input #1, ¹öÆÛ If i >= Àμö1 Then ''º¯¼ö ÀúÀå ¿Â÷ÄÚµå = Trim(Mid(¹öÆÛ, 7, 1)) ¿ùÀÌ¿ëȽ¼ö = Val(Mid(¹öÆÛ, 32, 2)) ¿©Çà°Å¸® = Val(Mid(¹öÆÛ, 27, 5)) ž½ÂÀοø = Val(Mid(¹öÆÛ, 24, 3)) ''¹è¿º¯¼ö ±¸Çϱâ If ¿Â÷ÄÚµå = "Z" Or ¿ùÀÌ¿ëȽ¼ö >= 7 Then Num = Num + 1 ÇÕ°è(Num) = ¿©Çà°Å¸® - ž½ÂÀοø Á¼®ÄÚµå(Num) = Trim(Mid(¹öÆÛ, 8, 2)) °í°´¹øÈ£(Num) = Val(Mid(¹öÆÛ, 1, 5)) End If End If Next i ''Á¤·Ä(ÇÕ°è ³»¸²Â÷¼ø or (ÇÕ°è °°À½ and °í°´¹øÈ£ ¿À¸§Â÷¼ø)) For i = 1 To Num For j = i To Num If ÇÕ°è(i) < ÇÕ°è(j) Or _ (ÇÕ°è(i) = ÇÕ°è(j) And °í°´¹øÈ£(i) > °í°´¹øÈ£(j)) Then Temp = ÇÕ°è(i) ÇÕ°è(i) = ÇÕ°è(j) ÇÕ°è(j) = Temp Temp = Á¼®ÄÚµå(i) Á¼®ÄÚµå(i) = Á¼®ÄÚµå(j) Á¼®ÄÚµå(j) = Temp Temp = °í°´¹øÈ£(i) °í°´¹øÈ£(i) = °í°´¹øÈ£(j) °í°´¹øÈ£(j) = Temp End If Next j Next i Close #1 ''Ãâ·Â ÆÄÀÏ Ã³¸® Open "c:\c_it\data\ans1.txt" For Output As #2 Print #2, Àμö1, Àμö2, Á¼®ÄÚµå(11) Close #2 End Sub |