题型:单选题 题类:常考题 难易度:困难
浙江省之江教育评价联盟2019-2020学年高三上学期信息技术第二次联考试卷
s = "defghiabc"
key = Text1.Text
i = 1: j = Len(s)
Do While i <= j
m = (i + j) \ 2
c = Mid(s, m, 1)
If c = key Then Exit Do
If Mid(s, i, 1) < c Then
If key >= Mid(s, i, 1) And key < c Then j = m - 1 Else i = m + 1
Else
If key > c And key <= Mid(s, j, 1) Then i = m + 1 Else j = m - 1
End If
ans = ans + Str(m)
Loop
运行程序后,若在文本框Text1中输入字符"b",则变量ans的值是( )
试题篮