Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
34
Task/ABC-Problem/Seed7/abc-problem.seed7
Normal file
34
Task/ABC-Problem/Seed7/abc-problem.seed7
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
$ include "seed7_05.s7i";
|
||||
|
||||
const func boolean: canMakeWords (in array string: blocks, in string: word) is func
|
||||
result
|
||||
var boolean: okay is FALSE;
|
||||
local
|
||||
var integer: index is 1;
|
||||
begin
|
||||
if word = "" then
|
||||
okay := TRUE;
|
||||
elsif length(blocks) <> 0 then
|
||||
while index <= length(blocks) and not okay do
|
||||
if blocks[index][1] = word[1] or blocks[index][2] = word[1] then
|
||||
okay := canMakeWords(blocks[.. pred(index)] & blocks[succ(index) ..], word[2 ..]);
|
||||
end if;
|
||||
incr(index);
|
||||
end while;
|
||||
end if;
|
||||
end func;
|
||||
|
||||
const array string: blocks is [] ("BO", "XK", "DQ", "CP", "NA", "GT", "RE", "TG", "QD", "FS",
|
||||
"JW", "HU", "VI", "AN", "OB", "ER", "FS", "LY", "PC", "ZM");
|
||||
|
||||
const func boolean: canMakeWords (in string: word) is
|
||||
return canMakeWords(blocks, upper(word));
|
||||
|
||||
const proc: main is func
|
||||
local
|
||||
var string: word is "";
|
||||
begin
|
||||
for word range [] ("", "A", "BARK", "BOOK", "TREAT", "COMMON", "SQUAD", "Confuse") do
|
||||
writeln(word rpad 10 <& canMakeWords(word));
|
||||
end for;
|
||||
end func;
|
||||
Loading…
Add table
Add a link
Reference in a new issue