用VB:
Dim a, b, c, i As Long
Dim a1, b1, c1 As Long
Dim a2, b2, c2, p, s, k As Long
Dim t As String
Dim x(9) As Integer
a = 100
b = 100
For k = 0 To 999
For i = 0 To 999
x(0) = 0
x(1) = 0
x(2) = 0
x(3) = 0
x(4) = 0
x(5) = 0
x(6) = 0
x(7) = 0
x(8) = 0
x(9) = 0
For j = 0 To 999
c = a * b
If c > 100000 Then Exit For
a1 = Val(Mid(CStr(a), 1, 1))
b1 = Val(Mid(CStr(a), 2, 1))
c1 = Val(Mid(CStr(a), 3, 1))
a2 = a1 * b
b2 = b1 * b
c2 = c1 * b
If a2 > 1000 Or b2 > 1000 Or c2 > 1000 Then Exit For
t = CStr(a) + CStr(b) + Right("00" + CStr(a2), 3) + Right("00" + CStr(b2), 3) + Right("00" + CStr(c2), 3) + CStr(c)
For p = 1 To Len(t)
s = Val(Mid(t, p, 1))
x(s) = x(s) + 1
If x(s) > 2 Then
p = 100000
Exit For
End If
Next
If p = 100000 Then Exit For
For p = 0 To 9
If x(p) > 2 Then Exit For
Next
If p = 10 Then
Text12.Text = CStr(a) + CStr(b)
p = -1
Exit For
Else
Exit For
End If
Next
If p = -1 Then Exit For
a = a + 1
Next
If p = -1 Then Exit For
b = b + 1
a = 100
Next 117x183={351,936,117}=21411 (1一共出现9次) 云梦 发表于 2013-8-14 13:49
224X179是唯一解,且0~9每个数字洽都出现两次,很有意思。
用VB:
Dim a, b, c, i As Long
这是随机写的VB程序。对所有100<a<1000,100<b<1000进行判断。
关键点:对符合条件的(每个数字都不超过两次)进行输出。
页:
1
[2]