首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

帮忙运行下,该如何解决

2012-03-04 
帮忙运行下小弟实在对VB一壳不通现有美女给我一端程序如下:OptionExplicitOptionBase1ConstlColAsLong1Wr

帮忙运行下
小弟实在对VB一壳不通       现有美女给我一端程序   如下:
Option   Explicit
Option   Base   1
Const   lCol   As   Long   =   1   '   Writes   in   Column   A

Sub   AlmostLangford()
Dim   iDigits(),   iNDigits   As   Integer,   lRow   As   Long

For   iNDigits   =   2   To   18   Step   2
ReDim   iDigits(iNDigits)
Call   AlmostLangfordN(iDigits,   lRow)
Next

End   Sub

Sub   AlmostLangfordN(ByRef   iDigits(),   ByRef   lRow   As   Long)
Dim   iPosFree   As   Integer,   iDigitsTmp(),   iDigit   As   Integer
Dim   iNDigits   As   Integer,   i   As   Integer

iNDigits   =   UBound(iDigits)
Do   While   True
'Checks   if   last   free   position   was   filled
If   iPosFree   <>   0   Then   If   IsEmpty(iDigits(iPosFree))   Then   Exit   Sub
'Determines   next   free   position
For   iPosFree   =   iPosFree   +   1   To   iNDigits
If   IsEmpty(iDigits(iPosFree))   Then   Exit   For
Next
If   iPosFree   =   iNDigits   +   1   Then   Exit   Sub

'   Tries   all   digits
For   iDigit   =   0   To   9
If   iPosFree   +   iDigit   +   1   >   iNDigits   Then   Exit   For
'   Checks   if   digit   already   used
For   i   =   1   To   iNDigits
If   iDigits(i)   =   iDigit   And   Not   IsEmpty(iDigits(i))   Then   Exit   For
Next
'   Cannot   start   with   zero
If   i   >   iNDigits   And   Not   (iPosFree   =   1   And   iDigit   =   0)   Then
If   IsEmpty(iDigits(iPosFree   +   iDigit   +   1))   Then
'   Initialises   idigitstmp
ReDim   iDigitsTmp(iNDigits)
For   i   =   1   To   iNDigits
iDigitsTmp(i)   =   iDigits(i)
Next
iDigitsTmp(iPosFree)   =   iDigit
iDigitsTmp(iPosFree   +   iDigit   +   1)   =   iDigit

'   Checks   if   array   is   full   (Almost-Langford   number)
For   i   =   1   To   iNDigits
If   IsEmpty(iDigitsTmp(i))   Then   Exit   For
Next
If   i   >   iNDigits   Then
lRow   =   lRow   +   1
Cells(lRow,   lCol)   =   " ' "   &   Join(iDigitsTmp,   " ")
Else
Call   AlmostLangfordN(iDigitsTmp,   lRow)   'iDigit   +   1
End   If
End   If
End   If
Next   iDigit
Loop

End   Sub
请问它的输出     谢谢大虾们       分数绝不吝啬

[解决办法]
2 3 4 2 11 3 10 4 9 5 8 1 7 1 6 5 11 10 9 8 7 6
n=11

热点排行