Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,30 @@
|
|||
$ include "seed7_05.s7i";
|
||||
|
||||
const func array bitset: ncsub (in bitset: seq, in integer: s) is func
|
||||
result
|
||||
var array bitset: subseq is 0 times {};
|
||||
local
|
||||
var bitset: x is {};
|
||||
var bitset: xs is {};
|
||||
var bitset: ys is {};
|
||||
begin
|
||||
if seq <> {} then
|
||||
x := {min(seq)};
|
||||
xs := seq - x;
|
||||
for ys range ncsub(xs, s + 1 - s rem 2) do
|
||||
subseq &:= x | ys;
|
||||
end for;
|
||||
subseq &:= ncsub(xs, s + s rem 2);
|
||||
elsif s >= 3 then
|
||||
subseq &:= {};
|
||||
end if;
|
||||
end func;
|
||||
|
||||
const proc: main is func
|
||||
local
|
||||
var bitset: seq is {};
|
||||
begin
|
||||
for seq range ncsub({1, 2, 3, 4}, 0) do
|
||||
writeln(seq);
|
||||
end for;
|
||||
end func;
|
||||
Loading…
Add table
Add a link
Reference in a new issue