日期:2024-05-04
浙江省2021-2022学年高三下学期信息技术5月高考考前测试卷试题详情
有如下VB程序段:
s=Text1.Text: n=Val(Text2.Text)
p=Len(s) Mod n
If p=0 Then p=n
i=1: cnt=0: m=″″
Do While i <=Len(s)-p+1
If Mid(s, i, p)=Mid(s, i+p, p) Then
cnt=cnt+1
s=Mid(s, 1, i-1)+Mid(s, i+p, Len(s)-p)
Else
i=i+1
End If
Loop
在文本框Text1和Text2中分别输入“abababcccddeffcb”和“2”,执行该程序段后,变量cnt的值是( )
- A、3
- B、1
- C、2
- D、4