- ©«¤l
- 1
- ¥DÃD
- 1
- ºëµØ
- 0
- ¿n¤À
- 2
- ÂI¦W
- 0
- §@·~¨t²Î
- window10
- ³nÅ骩¥»
- office 2007
- ¾\ŪÅv
- 10
- µù¥U®É¶¡
- 2016-11-25
- ³Ì«áµn¿ý
- 2016-11-26
|
«æ¡I¥Îvb°µ³Ìµu¸ô®|
Public Class Form1
Dim best(100, 100) As Integer
Dim dis(100) As Integer
Dim d, i, b, en As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Do While True
d = Val(InputBox("½Ð¿é¤J¸`ÂIÁ`¼Æ", "³Ìµu¸ô®|", 1))
b = Val(InputBox("½Ð¿é¤J°_ÂI", "³Ìµu¸ô®|", 1))
en = Val(InputBox("½Ð¿é¤J²×ÂI", "³Ìµu¸ô®|", 1))
If Val(b) = Val(en) Or d < 0 Or b < 0 Or en < 0 Or b > d Or en > d Then
MsgBox("¿é¤J¿ù»~")
Else
Exit Do
End If
Loop
For R = 1 To 100
For P = 1 To 100
best(R, P) = 10000
Next
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Val(d) < Val(TextBox1.Text) Or Val(d) < Val(TextBox2.Text) Then
MsgBox("¿é¤J¿ù»~")
Else
best(Val(TextBox1.Text), Val(TextBox2.Text)) = Val(TextBox3.Text)
best(Val(TextBox2.Text), Val(TextBox1.Text)) = Val(TextBox3.Text)
MsgBox("¿é¤J¦¨¥\¡I½Ð¦A¿é¤J¨ä¥L¼ÆÈ¡I")
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim q, min As Integer
Dim c(100) As Boolean
For m = 1 To 100 Step 1
dis(i) = best(Val(b), i)
c(i) = False
Next
For m = 1 To 100
min = 10000
For j = 1 To 100
If c(j) = False And dis(j) <> 10000 Then
min = dis(j)
q = j
End If
Next
c(q) = True
For v = 1 To 100
If dis(v) > dis(q) + best(q, v) And best(q, v) <> 10000 Then
dis(v) = dis(q) + best(q, v)
dis(v) = min
End If
Next
Next
End Sub
End Class
³o¬O§Úªºµ{¦¡½X¦ý§Úªº¹Bºâªk¦n¹³¯Ê¤F¬Æ»ò
§Ú¥ý³]¤FÁ`ÂI¼Æ¡B°_ÂI»P²×ÂI
±µµÛ¿é¤J¥þ³¡¶ZÂ÷¼ÆÈ
³Ì«á·Qn¶]¥X©Ò¸g¹LªºÂI»P³Ì¨Î¸ô®|ªø |
|