题型:综合题 题类:常考题 难易度:普通
浙江省杭州市第二中学2020届高三上学期信息技术第一次月考试卷
参赛班级用数字1,2,3,4……number表示,依次存入数组a(1)~a(number),若1号班级的编号为5,则a(1)=5。
Dim a(1 To 50) As Integer, T As Integer, Number As Integer, Total As Integer
Private Sub Form_Load()
’产生Number的值,表示参赛人数,产生Total的值,表示包含的班级数’产生Number个编号为1-Total的班级编号,并存储在数组a中’代码略
Private Sub Command1_Click()
Dim mid As Integer
i=Total: j=Number
Do While i<=j
mid=(i+j)\2
If pd(mid)= ① Then
j=mid-1
ans=mid
Else
i=mid+1
Dim b(1 To 100)As Integer
Dim T As Integer
pd=False
For i=1 To Number-M+1
For j=i To i+M-1
②
Next j
T=0
For j=1ToTotal
T=T+b(j)
EndIf
Loop
Text1.Text=Str(ans)
End Sub
Function pd(M As Integer)As Boolean
Next j
If T=③ Then pd=True: Exit Function
Next i
End unction
试题篮