Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
23
Task/ABC-Problem/SPAD/abc-problem.spad
Normal file
23
Task/ABC-Problem/SPAD/abc-problem.spad
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
blocks:List Tuple Symbol:= _
|
||||
[(B,O),(X,K),(D,Q),(C,P),(N,A),(G,T),(R,E),(T,G),(Q,D),(F,S), _
|
||||
(J,W),(H,U),(V,I),(A,N),(O,B),(E,R),(F,S),(L,Y),(P,C),(Z,M)]
|
||||
|
||||
|
||||
findComb(l:List List NNI):List List NNI ==
|
||||
#l=0 => []
|
||||
#l=1 => [[s] for s in first l]
|
||||
r:List List NNI:=[]
|
||||
for y in findComb(rest l) repeat
|
||||
r:=concat(r,[concat(x,y) for x in first l])
|
||||
return r
|
||||
|
||||
canMakeWord?(word,blocks) ==
|
||||
word:=upperCase word
|
||||
bchr:=[map(char,map(string,s::List(Symbol))) for s in blocks]
|
||||
c:=[[j for j in 1..#blocks | member?(word.k,bchr.j)] for k in 1..#word]
|
||||
reduce(_or,[test(#removeDuplicates(l)=#word) for l in findComb(c)])
|
||||
|
||||
|
||||
Example:=["a","bark","book","treat","common","squad","confuse"]
|
||||
|
||||
[canMakeWord?(s,blocks) for s in Example]
|
||||
Loading…
Add table
Add a link
Reference in a new issue