有如下程序段: 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的值是( )
A . 5
B . 5 7 8
C . 5 3
D . 5 7
答案:D