试题

试题 试卷

logo

题型:单选题 题类:常考题 难易度:普通

【bj】高中信息技术综合库——枚举算法及程序实现1

有如下程序段:

For i = 2 To 6

    For j = 1 To i - 1

        If a(j) <= a(i) And d(j) >= d(i) Then

            d(i) =d(j)+1 : pre(i) = j

        End If

    Next j

Next i

max = 0 : k = 0

For i = 1 To 6

    If d(i)>max Then max = d(i) : k = i

Next i

Do While k <> 0

    st = a(k) & ","& st

    k=pre(k)

Loop

Text1.Text = Mid(st, 1, Len(st) - 1)

数组元素a(1)到a(6)的值依次为“2,6,5,9,8,8”,数组d各元素的值初始化为1,数组pre各元素的值初始化为0,经过该程序段“加工”后,Text1中的值是(   )

A、2,5,9 B、2,6,8,8 C、2,5,8,8 D、2,5,6,8,8,9
举一反三
返回首页

试题篮