September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
28
Task/ABC-Problem/AppleScript/abc-problem-1.applescript
Normal file
28
Task/ABC-Problem/AppleScript/abc-problem-1.applescript
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
set blocks to {"bo", "xk", "dq", "cp", "na", "gt", "re", "tg", "qd", "fs", ¬
|
||||
"jw", "hu", "vi", "an", "ob", "er", "fs", "ly", "pc", "zm"}
|
||||
|
||||
canMakeWordWithBlocks("a", blocks)
|
||||
canMakeWordWithBlocks("bark", blocks)
|
||||
canMakeWordWithBlocks("book", blocks)
|
||||
canMakeWordWithBlocks("treat", blocks)
|
||||
canMakeWordWithBlocks("common", blocks)
|
||||
canMakeWordWithBlocks("squad", blocks)
|
||||
canMakeWordWithBlocks("confuse", blocks)
|
||||
|
||||
on canMakeWordWithBlocks(theString, constBlocks)
|
||||
copy constBlocks to theBlocks
|
||||
if theString = "" then return true
|
||||
set i to 1
|
||||
repeat
|
||||
if i > (count theBlocks) then exit repeat
|
||||
if character 1 of theString is in item i of theBlocks then
|
||||
set item i of theBlocks to missing value
|
||||
set theBlocks to strings of theBlocks
|
||||
if canMakeWordWithBlocks(rest of characters of theString as string, theBlocks) then
|
||||
return true
|
||||
end if
|
||||
end if
|
||||
set i to i + 1
|
||||
end repeat
|
||||
return false
|
||||
end canMakeWordWithBlocks
|
||||
Loading…
Add table
Add a link
Reference in a new issue