Private Sub Command1_Click( )
Dim a(1 To 100) As Integer
Dim i As Integer, j As Integer
Dim temp As Integer, k As Integer
Dim res As Integer, ed As Integer
'从文本框Text1中读入整数存储到数组a中,整数的个数存放在变量k中,代码略
For i=1 Tok\ 2-1 '以区间左边数据为主要关键字升序排序
For j=k\2 To i+1 Step-1
If Then
temp=a(j*2-1):a(j*2-1)=a((j-1)*2-1):a((j-1)*2-1)=temp.
temp=a(j*2):a(j*2)=a((j-1)*2):a((j-1)*2)=temp
End If
Next j
Next i
ed=a(2)
res= 0
For i=2 To k\2 '计算需要删除区间的最小数量
If Then
res=res+1
ed= min(ed, )
Else
ed=a(i * 2)
End If
Next i
Text2. Text= Str(res)
End Sub
Function min(x As Integer, y As Integer) As Inte-ger '函数功能:返回x与y的最小值
'代码略
End Function