本帖最后由 3mile 于 2010-11-26 13:58 编辑
回复 8# 蜘蛛抱蛋
我误解了吗?也许吧。
结果的每一横行为一天的比赛安排。
还是把天数安排加上吧。
#include <array.au3>
Local $a = 0, $temp = 2, $array[1][2]
Local $input = InputBox('输入', '请输入选手人数', '8')
For $i = 1 To $input
For $n = $temp To $input
ReDim $array[$a + 2][2]
$array[$a][0] = '选手' & $i
$array[$a][1] = '选手' & $n
$a += 1
Next
$temp += 1
Next
_ArrayDelete($array, UBound($array))
$a = 0
$temp = ''
$array1 = $array
Local $fin, $go
For $n = 0 To $input - 1 - 1
$temp &= "第" & $n + 1 & "天" & @TAB
$temp &= $array1[$n][0] & '对' & $array1[$n][1] & '|'
For $i = 0 To UBound($array) - 1
If Not StringInStr($temp, $array[$i][0]) And Not StringInStr($temp, $array[$i][1]) Then
$temp &= $array[$i][0] & '对' & $array[$i][1] & '|'
$go &= $i & '|'
EndIf
Next
$del = StringSplit(StringTrimRight($go, 1), '|')
For $y = $del[0] To 1 Step -1
_ArrayDelete($array, $del[$y])
Next
$go = ''
$fin &= $temp & @CRLF
$temp = ''
Next
MsgBox(0, 0, $fin)
|