当前位置: 高中信息技术 / 单选题
  • 1. (2020高三下·金华月考) 如果数组a(下标1到n)满足a(1)≤a(2)≤…≤a(i-1)≤a(i)≥a(i+1)≥…≥a(n),则称数组a是单峰的,并称a(i)是数组a的“峰顶”。下列程序段用于查找数组a中的“峰顶”,并返回该“峰顶”值。

    Dim a(1 To 10) As Integer

    Function Search(L As Integer, R As Integer) As Integer

     M = (L + R) \ 2

     If a(M) < a(M - 1) And a(M) > a(M + 1) Then

         ⑴  

     ElseIf a(M) > a(M - 1) And a(M) > a(M + 1) Then

         ⑵  

     ElseIf a(M) > a(M - 1) And a(M) < a(M + 1) Then

        ⑶  

     End If

    End Function

    Private Sub Command1_Click()

     Label1.Caption = "“峰顶”值是:" + Str(Search(1, 10))

    End Sub

    上述程序中划线处可选语句为:

    ①Search = Search(M + 1 , R)

    ②Search = Search(L , M - 1)

    ③Search = a(M)

    则(1)(2)(3)处的语句依次是(  )

    A . ①②③ B . ①③② C . ③①② D . ②③①

微信扫码预览、分享更方便