Virtual Object
::
Programs
:: Генерация сочетаний |
||||
Наша кнопка |
||||
Генерация сочетаний {$APPTYPE CONSOLE} var n,k,i,j:integer; a:array [0..1000] of integer; begin assign(input,′input.txt′); reset(input); assign(output,′output.txt′); rewrite(output); read(n,k); a[0]:=-1; for i:=1 to k do a[i]:=i; j:=1; while (j<>0) do begin for i:=1 to k do write(a[i],′ ′); writeln; j:=k; while (a[j]=n-k+j) do dec(j); inc(a[j]); for i:=j+1 to k do a[i]:=a[i-1]+1; end; end. |
||||
Object © 2004 - 2005. All rights reserved. |