我爱数学真好玩七字代表0—9之间不同的数字这七个字可编成:玩+好玩+真好玩+学真好玩+数学真好玩+爱数学真好玩+我爱数学真好玩=学学学学学学学

问题描述:

我爱数学真好玩七字代表0—9之间不同的数字
这七个字可编成:
玩+好玩+真好玩+学真好玩+数学真好玩+爱数学真好玩+我爱数学真好玩=学学学学学学学

编程搜索,只有一组 6 3 8 2 7 5 1
Private Sub Command1_Click()
Dim a(9) As Long
Dim b(9) As Long
For i = 0 To 9
a(i) = 1
For j = 0 To 9
If a(j) = 0 Then
a(j) = 1
For k = 1 To 9
If a(k) = 0 Then
a(k) = 1
For l = 0 To 9
If a(l) = 0 Then
a(l) = 1
For m = 0 To 9
If a(m) = 0 Then
a(m) = 1
For n = 0 To 9
If a(n) = 0 Then
a(n) = 1
For p = 0 To 9
If a(p) = 0 Then
If i * 7 + j * 10 * 6 + k * 100 * 5 + l * 1000 * 4 + m * 10000 * 3 + n * 100000 * 2 + p * 1000000 = l * 1111111 Then
Debug.Print i; j; k; l; m; n; p
End If
End If
Next p
a(n) = 0
End If
Next n
a(m) = 0
End If
Next m
a(l) = 0
End If
Next l
a(k) = 0
End If
Next k
a(j) = 0
End If
Next j
a(i) = 0
Next i
End Sub

==

玩+好玩+真好玩+学真好玩+数学真好玩+爱数学真好玩+我爱数学真好玩=学学学学学学学
我1 爱5 数7 学2 真8 好3 玩6
6 + 36 + 836 + 2836 + 72836 + 572836 + 1572836=2222222