用1、2、3、4、5、6、7、8、9九个数,使算式成立,算式是4位数乘以一位数等于4位数每个数字不得重复使用
用1、2、3、4、5、6、7、8、9九个数,使算式成立,算式是4位数乘以一位数等于4位数
每个数字不得重复使用
1738 * 4 = 6952
1963 * 4 = 7852
我用vb代码简单进行了实现,结果存入一个文件中,代码如下:
Private Sub Command1_Click()
fn = FreeFile
Open App.Path & "\lk.txt" For Output As #fn
For i = 1 To 9
DoEvents
For j = 1 To 9
DoEvents
For k = 1 To 9
DoEvents
For l = 1 To 9
DoEvents
If Str(i) Str(j) And Str(i) Str(k) And Str(i) Str(l) And Str(i) Str(m) And _
Str(j) Str(k) And Str(j) Str(l) And Str(j) Str(m) And _
Str(k) Str(l) And Str(k) Str(m) And _
Str(l) Str(m) Then
ii = Str(i) & Str(j) & Str(k) & Str(l)
For m = 1 To 9
DoEvents
iii = Val(ii) * m
If Len(iii) Print #fn, Val(ii) & " X " & m & " = " & iii
End If
Next
End If
Next
Next
Next
Next
Close #fn
End Sub
6952 / 4 = 1738
7852 /4 = 1963
1738 * 4 = 6952
1963 * 4 = 7852