模拟抽签程序已经应用于首届QQ大赛的分组
Program p74; Const f:array[1..10] of char =('A','B','C','D','E','F','G','H','I','J'); var r:array[0..10] of byte; I,j,k,p,e:integer; Begin For I:=1 to 9 do r[I]:=I+1; R[0]:=1;r[10]:=0; I:=10;randomize; While I>0 do Begin K:=1+random(i);p:=0; For j:=1 to k do Begin E:=p;p:=r[p]; End; R[e]:=r[p]; Write(I,'-',f[p],' ');I:=I-1; End; Writeln End.
|