用02578这五个数字组成一个两位数和一个三位数每个数只能用一次,这两个数的积最大是多少最小是多少?
用02578这五个数字组成一个两位数和一个三位数共有72个,
两个数的积最大是75*820=61500,或 82*750=61500,
两个数的积最小是20*578=11560。
这些数的组合我是用EXCEL的VBA程序求出的:
Sub 宏1()
h = 3
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
If Not (a = b Or a = c Or a = d Or a = e Or b = c Or b = d Or b = e Or c = d Or c = e Or d = e) Then
x = Cells(1, a) & Cells(1, b)
y = Cells(1, c) & Cells(1, d) & Cells(1, e)
If Cells(1, a) <> 0 Then
If Cells(1, c) <> 0 Then
Cells(h, 1) = x
Cells(h, 2) = y
h = h + 1
End If
End If
End If
Next e, d, c, b, a
End Sub