Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
28
Task/ABC-problem/Yabasic/abc-problem.basic
Normal file
28
Task/ABC-problem/Yabasic/abc-problem.basic
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
letters$ = "BO,XK,DQ,CP,NA,GT,RE,TG,QD,FS,JW,HU,VI,AN,OB,ER,FS,LY,PC,ZM"
|
||||
|
||||
sub canMake(letters$, word$)
|
||||
local i, j, p, n, pairs$(1)
|
||||
|
||||
n = token(letters$, pairs$(), ",")
|
||||
word$ = upper$(word$)
|
||||
|
||||
for i = 1 to len(word$)
|
||||
for j = 1 to n
|
||||
p = instr(pairs$(j), mid$(word$, i, 1))
|
||||
if p then
|
||||
pairs$(j) = ""
|
||||
break
|
||||
end if
|
||||
next j
|
||||
if not p return false
|
||||
next i
|
||||
return true
|
||||
end sub
|
||||
|
||||
print "a = ", canMake(letters$, "a") // 1 = true
|
||||
print "bark = ", canMake(letters$, "Bark") // 1
|
||||
print "book = ", canMake(letters$, "BooK") // 0 = false
|
||||
print "treat = ", canMake(letters$, "TREAt") // 1
|
||||
print "common = ", canMake(letters$, "common") // 0
|
||||
print "squad = ", canMake(letters$, "squad") // 1
|
||||
print "confuse = ", canMake(letters$, "confuse") // 1
|
||||
Loading…
Add table
Add a link
Reference in a new issue