满意答案
rwqrdhhetb
2013.06.09
采纳率:48% 等级:12
已帮助:16687人
Private Sub Command1_Click()
For a = 1 To 5
For b = 1 To 5
For c = 1 To 5
For d = 1 To 5
For e = 1 To 5
a1 = (b = 2) Or (a = 3)
b1 = (b = 2) Or (e = 4)
c1 = (c = 1) Or (d = 2)
d1 = (c = 5) Or (d = 3)
e1 = (e = 4) Or (a = 1)
If a1 And b1 And c1 And d1 And e1 And a * b * c * d * e = 120 Then
strt = strt & a & " " & b & " " & c & " " & d & " " & e & vbCrLf
End If
Next
Next
Next
Next
Next
MsgBox strt
End Sub
2种结果
不是只有5+4+3+2+1=15而已 所以你用
15 - (A + B + C + D) 当条件 不合理
用我的代码就好
A说的2个答案只有一个是真的 用or(或) 只要其中一个答案为真 a1就为真
a1 = (b = 2) Or (a = 3)
因为5个数都不互相等 所以积120的组成元素是唯一的
不会出现 5+4+3+2+1=15 5+3+3+3+1 也等于15 这样的情况
00分享举报