Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
19
Task/ABC-problem/Julia/abc-problem.julia
Normal file
19
Task/ABC-problem/Julia/abc-problem.julia
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
using Printf
|
||||
|
||||
function abc(str::AbstractString, list)
|
||||
isempty(str) && return true
|
||||
for i in eachindex(list)
|
||||
str[end] in list[i] &&
|
||||
any([abc(str[1:end-1], deleteat!(copy(list), i))]) &&
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
let test = ["A", "BARK","BOOK","TREAT","COMMON","SQUAD","CONFUSE"],
|
||||
list = ["BO","XK","DQ","CP","NA","GT","RE","TG","QD","FS",
|
||||
"JW","HU","VI","AN","OB","ER","FS","LY","PC","ZM"]
|
||||
for str in test
|
||||
@printf("%-8s | %s\n", str, abc(str, list))
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue