AW: und noch eine Variante...
29.12.2013 17:32:55
Erich
Hi Erhard,
als Punktesumme über alle Permutationen biete ich 6999840.
Ein möglicher Code dafür:
Option Explicit
Dim aPerm(1 To 3628800) As String
Sub aStart()
Dim tt As String, zz As Long, lngSu As Long
tt = "0123456789"
Perm tt, "", 0
For zz = 1 To UBound(aPerm)
lngSu = lngSu + maxZiff(aPerm(zz))
Next zz
MsgBox lngSu
End Sub
Sub Perm(aa$, bb$, Ze&)
Dim ii%, jj%: jj = Len(aa)
If jj > 1 Then
For ii = 1 To jj
Perm Left(aa, ii - 1) + Right(aa, jj - ii), bb + Mid(aa, ii, 1), Ze
Next ii
Else
Ze = Ze + 1
aPerm(Ze) = bb & aa
End If
End Sub
Function maxZiff(strZ As String) As Long
Dim pp As Long, qq As Long, strP As String
For pp = 2 To Len(strZ)
strP = Mid(strZ, pp, 1)
For qq = 1 To pp - 1
If Mid(strZ, qq, 1) >= strP Then Exit For
Next qq
If qq >= pp Then maxZiff = maxZiff + 1
Next pp
End Function
Rückmeldung ist bei dir eh klar - Grüße aus Kamp-Lintfort von Erich