Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -0,0 +1,33 @@
|
|||
$ include "seed7_05.s7i";
|
||||
|
||||
const func string: missingPermutation (in array string: perms) is func
|
||||
result
|
||||
var string: missing is "";
|
||||
local
|
||||
var integer: pos is 0;
|
||||
var set of char: chSet is (set of char).EMPTY_SET;
|
||||
var string: permutation is "";
|
||||
var char: ch is ' ';
|
||||
begin
|
||||
if length(perms) <> 0 then
|
||||
for key pos range perms[1] do
|
||||
chSet := (set of char).EMPTY_SET;
|
||||
for permutation range perms do
|
||||
ch := permutation[pos];
|
||||
if ch in chSet then
|
||||
excl(chSet, ch);
|
||||
else
|
||||
incl(chSet, ch);
|
||||
end if;
|
||||
end for;
|
||||
missing &:= min(chSet);
|
||||
end for;
|
||||
end if;
|
||||
end func;
|
||||
|
||||
const proc: main is func
|
||||
begin
|
||||
writeln(missingPermutation([] ("ABCD", "CABD", "ACDB", "DACB", "BCDA", "ACBD",
|
||||
"ADCB", "CDAB", "DABC", "BCAD", "CADB", "CDBA", "CBAD", "ABDC", "ADBC",
|
||||
"BDCA", "DCBA", "BACD", "BADC", "BDAC", "CBDA", "DBCA", "DCAB")));
|
||||
end func;
|
||||
Loading…
Add table
Add a link
Reference in a new issue