感谢诸位参与!以下是我的解,跟afan兄思路相似。#include <Array.au3>
Local $sInitSeq = "912345678"
Local $iNumberofBooks = StringLen($sInitSeq)
Local $iObjIndex = $iNumberofBooks
Local $iSelfIndex, $sTempSeq, $sResult = $sInitSeq & ","
Local $iTimer = TimerInit()
While $iObjIndex
If StringMid($sInitSeq, $iObjIndex, 1) = $iObjIndex Then
$iObjIndex -= 1
Else
$sTempSeq = $sInitSeq
$iSelfIndex = StringMid($sTempSeq, $iObjIndex, 1)
$sInitSeq = StringLeft($sTempSeq, $iSelfIndex - 1) & $iSelfIndex
$sInitSeq &= StringMid($sTempSeq, $iSelfIndex, $iObjIndex - $iSelfIndex)
$sInitSeq &= StringTrimLeft($sTempSeq, $iObjIndex)
$sResult &= $sInitSeq & ","
EndIf
WEnd
$sResult = StringSplit(StringTrimRight($sResult, 1), ",")
_ArrayDisplay($sResult, TimerDiff($iTimer))
|