2010年9月10日 星期五

93q6

Public Class Form1
    Private Sub Form1_Load(ByVal sender1 As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim i, j
        Dim str2 = ""
        Dim str1 = ""
        Dim a(51, 51)
        a(1, 0) = 0 : a(1, 1) = 1 : a(1, 2) = 0
        a(2, 0) = 0 : a(2, 1) = 1 : a(2, 2) = 2 : a(2, 3) = 1 : a(2, 4) = 0
        str1 = 1
        str2 = str2 & str1 & vbNewLine
        str1 = 1 & ", " & 2 & ", " & 1
        str2 = str2 & str1 & vbNewLine
        For j = 3 To 10
            str1 = ""
            a(j, 1) = 1
            str1 = str1 & 1 & ", "
            For i = 2 To j
                a(j, i) = a(j - 1, i - 1) + a(j - 1, i)
                str1 = str1 & a(j, i) & ", "
            Next
            a(j, i) = 1
            str1 = str1 & 1
            str2 = str2 & str1 & vbNewLine
        Next j
        MsgBox(str2)
    End Sub
End Class

沒有留言: