Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
26
Task/ABC-problem/MiniScript/abc-problem.mini
Normal file
26
Task/ABC-problem/MiniScript/abc-problem.mini
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
allBlocks = ["BO", "XK", "DQ", "CP", "NA", "GT", "RE", "TG", "QD", "FS", "JW", "HU", "VI", "AN", "OB", "ER", "FS", "LY", "PC", "ZM"]
|
||||
|
||||
swap = function(list, index1, index2)
|
||||
tmp = list[index1]
|
||||
list[index1] = list[index2]
|
||||
list[index2] = tmp
|
||||
end function
|
||||
|
||||
canMakeWord = function(str, blocks)
|
||||
if str == "" then return true
|
||||
c = str[0].upper
|
||||
for i in range(0, blocks.len - 1)
|
||||
bl = blocks[i]
|
||||
if c != bl[0] and c != bl[1] then continue
|
||||
swap blocks, 0, i
|
||||
if canMakeWord(str[1:], blocks[1:]) then return true
|
||||
swap blocks, 0, i
|
||||
end for
|
||||
return false
|
||||
end function
|
||||
|
||||
for val in ["", "A", "BARK", "book", "Treat", "COMMON", "sQuAD", "CONFUSE"]
|
||||
out = """"""
|
||||
if val.len != 0 then out = val
|
||||
print out + ": " + canMakeWord(val, allBlocks)
|
||||
end for
|
||||
Loading…
Add table
Add a link
Reference in a new issue