①早上6:30校园广播自动响起,提醒同学们起床
②上课时,老师在一体机上通过手写输入录入文字
③教学楼走廊的灯检测到有人靠近时会自动打开
④英语课上,老师通过有道词典的在线翻译功能辅助进行翻译
⑤晚自习结束,通过人脸识别系统进行入寝点名
使用了人工智能技术的有
For i = 1 To 5
a(i)= Int(Rnd * 10)
Next i
For i = 2 To 5
If a(i) < a(i -1) And a(i) Mod 2 = 1 Then
a(i) = a(i) + 1
ElseIf a(i) Mod 2 = 0 And i Mod 2 = 0 Then
a(i) = a(i -1) -1
End If
Next i
执行程序后,a数组各元素不可能是( )
Private Sub Command1_Click( )
Dim tmp As String
Dim n As Integer, t As Integer
Dim i As Integer, j As Integer, k As Integer
n = Val(Text1.Text)
For i = 0 To ⑴
tmp = ""
k = i
For j = 1 To n
t = k Mod 2
⑵
⑶
Next j
List1.AddItem tmp
Next i
End Sub
可选的代码如下:
①2 ^ n -1
②2 ^ n
③k = k \2
④t=t\2
⑤tmp = Str(t) + tmp
⑥tmp = tmp +Str(t)
则程序(1)、(2)、(3)处的代码依次为( )
i = 1: j = 1000: flag = True: p = 0
key = Val(Text1.Text)
Do While i <= j And flag
m = (i + j) \2
p = p + 1
If a(m) = key Then flag = False
If a(m) > key Then j = m -1 Else i = m + 1
Loop
数组元素a(1)到a(1000)中存放着升序排列的数据。下列说法正确的是( )
例如:依次输入以下区间:[2 5],[4 7],[1 4],[5 9],[4 5],[2 4],数轴如下:
坐标点“4”覆盖了[2 5],[4 7],[1 4],[4 5],[2 4]共5个区间,坐标点“9”覆盖了[5 9]区间,所以覆盖这6个区间所需的坐标点数为2个。
程序运行界面如图所示。
实现上述功能的VB代码如下:
Dim n As Integer
Dim a(1 To 100) As Integer
Private Sub Input_Click()
'输入n个正整数区间,依次存放到数组
'a(1)到a(2*n)中,并在List1中显示
'代码略
End Sub
Private Sub Count_Click()
Dim right As Integer, t As Integer, k As Integer
Dim tmp As Integer, i As Integer, ans As Integer
‘改错
ans = 1: t = 3
Do While t < 2 * n
If ① Then
If a(t + 1) < right Then right = a(t + 1)
Else
ans = ans + 1
right = a(t + 1)
End If
②
Loop
Text3.Text = Str(ans)
End Sub
请回答下列问题:
① ②
·将字符串(均为大写字符)s依次转换为相对应的数值(字符A~Z对应数值1~26);
·转换后的数值以K个数据为一段,将n个待处理的数据依次分割成若干段(最后一段不足部分用0来补充);
·每一段中K个数据与K*K转置矩阵进行乘法运算;
·将乘法运算得到的每一个结果值除以26求余数,依次转换成相应字符(数值1~26对应字符A~Z),最后按原始字符串长度输出。
乘法运算规则如下:
第i个元素c(i) =第j个元素a(j) * 转置矩阵第i行第j个元素b(t)的乘积之和(其中j = 1 , 2 …K)
例如:字符串s = PYTHON,区块大小K = 4的转置过程如下:
Private Sub Command1_Click()
Dim a(1 To 100) As Integer ‘存储字符串,长度不超过100个字符
Dim b(1 To 100) As Integer ‘存储转置矩阵,长度不超过10*10
Dim c(1 To 100) As Long
Dim s As String, tmp As String
Dim k As Integer, t As Integer, i As Integer, j As Integer
Dim n As Integer, m As Integer, lens As Integer
s = Text1.Text ‘在Text1中输入原始字符串
k = Val(Text2.Text) ‘在Text2中输入区块大小K
Randomize
For i = 1 To k ^ 2
b(i) = Int(Rnd * 9) + 1
tmp = tmp + Str(b(i))
If i Mod k = 0 Then
List2.AddItem tmp
tmp = ""
End If
Next i
lens = Len(s): n = lens
For i = 1 To n
tmp = Mid(s, i, 1)
List1.AddItem Str(a(i))
Next i
Do While n Mod k <> 0
n = n + 1
a(n) = 0
List1.AddItem Str(a(n))
Loop
For i = 1 To n
m = (i -1) Mod k + 1
t = 1
For j =
c(i) = a(j) * b((m -1)* k + t) + c(i)
t = t + 1
Next j
Next i
For i = 1 To n
List3.AddItem Str(c(i))
Next i
s = ""
For i = 1 To lens
s = s + Chr(t + 64)
Next i
Text3.Text = s ‘在Text3中输出转置后的字符串
End Sub