高中计算机在线使用方法,高中-信息技术-手动搜题-在线组卷

(2)

实现上述功能的VB程序如下,请在划线处填入合适的代码。

Dim n As Integer, t As Integer, m As Integer, I As Integer, j As

Integer

Dim ans As Integer, u As Integer, st As Integer, p As Long

Dim a(21) As Integer, b(11) As Integer, f(11) As Integer

Dim c(11)As Integer       '用于存储构成一笔画各边的序号

Dim s As String, ss As String

Private Sub Command1_Click()

n= Val(Text1.Text)

s= Text2.Text: t= 0

For j= 1 To Len(s)

ch =

Mid(s, j, 1)

If ch

= "," Then

b(a(t))

= b(a(t)+1

t=t+1

a(t)=

0

Else

a(t)=

a(t)*10 + Val(ch)

End

If

Next j

________: m=t\2: ans=0

st= 1

For i= 1 To n

If b(i) Mod 2=1 Then

ans = ans+ 1: st=i

Next i

If ans=0 Or ans=2 Then

For p=1 To m^m    '穷举边的顺序

If try(p) Then

u= st: ss =

Str(u)

For j=1 To m

If (a(c(j)* 2)<>u) And (a(c(j)*2-1)<>u)

Then Exit For

If________

Then u= a(c(j)*2- 1) Else u=a(c(j)*2)

ss=ss

+"->"+ Str(u)

Next j

If j> m

Then Exit For

End If

Next p

Else

ss="无法一笔画!"

End If

Label3.Caption=ss

End Sub

Function try(x As Long) As Boolean      '生成边的访问顺序,并判断有无重复的边

Dim k As Integer, y As

Long

y=x

For k=1 To m

c(k)=y Mod m+1: y-y\m

If f(c(k)) = x Then

Exit For

________

Next k

If k> m Then try=True

Else try = False

End Function

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值