![]() |
#2
yz10252013-01-24 23:00
无聊到帮人写作业
![]() ![]() Option Explicit Dim MyNumber() As String, NumRange As Integer Dim MyNumber1() As String Private Sub Command1_Click() Dim i As Integer, j As Integer, tmpNumRange As Integer Dim X As String NumRange = Val(Text1.Text) X = Val(Text2.Text) If ((NumRange > 14) And (X > 1)) Then tmpNumRange = NumRange ReDim MyNumber(X, NumRange) For i = 0 To UBound(MyNumber, 1) For j = 0 To tmpNumRange MyNumber(i, j) = j + 1 Next j tmpNumRange = tmpNumRange - 1 Next i Call GetNumber Else MsgBox "Number Too Small !" End If Text1.Text = "" End Sub Private Sub Text1_Change() Text1.Text = Val(Text1.Text) End Sub Private Sub Text1_KeyPress(KeyAscii As Integer) If ((KeyAscii < 48) Or (KeyAscii > 57)) Then Exit Sub End Sub Private Sub Text2_Change() Text2.Text = Val(Text2.Text) End Sub Private Sub Text2_KeyPress(KeyAscii As Integer) If ((KeyAscii < 48) Or (KeyAscii > 57)) Then Exit Sub End Sub Private Sub GetNumber() Dim i As Integer, j As Integer, k As Integer Dim tmpNumRange As Integer, SN As Integer k = UBound(MyNumber, 1) ReDim MyNumber1(k) For i = 0 To k If i = 0 Then tmpNumRange = UBound(MyNumber, 2) For j = 0 To 4 Randomize SN = CInt(Rnd * tmpNumRange) If MyNumber1(i) <> "" Then MyNumber1(i) = MyNumber1(i) & "-" & MyNumber(i, SN) Else MyNumber1(i) = MyNumber(i, SN) End If Next j tmpNumRange = tmpNumRange - 1 Next i MsgBox Join(MyNumber1, vbCrLf) End Sub 最后一句我看不懂意思... |
已知:
数列S(1. 2.....N),N可自定
数列A,从数列S取出M个数,N>M(可自选数字)
数列B,同上
.
.
.
数列H,同上
从数列A任取5个数,做为一个组合,形成集合a
从数列B任取5个数,做为一个组合,形成集合b
...
从数列H任取5个数,做为一个组合,形成集合h
求:
a-b-c-d-...-h得到的X
从X中组合的数字,含有数列B,数列C。。。中的数
例子
S(1 2 3...20)
A(1...10,13,14,15,16,17)
B(2,3,4....11,12)
X中含有“13,14,15,16,17”,而这组合是必须没有的