June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
|
|
@ -0,0 +1,25 @@
|
|||
# look and say
|
||||
|
||||
dim a$(2)
|
||||
|
||||
i = 0 # input string index
|
||||
|
||||
a$[i] = "1"
|
||||
|
||||
print a$[i]
|
||||
|
||||
for n=1 to 10
|
||||
j = 1 - i # output string index
|
||||
a$[j] = ""
|
||||
k = 1
|
||||
while (k <= length(a$[i]))
|
||||
k0 = k + 1
|
||||
while ((k0 <= length(a$[i])) and (mid(a$[i], k, 1) = mid(a$[i], k0, 1)))
|
||||
k0 = k0 + 1
|
||||
end while
|
||||
a$[j] += string(k0 - k) + mid(a$[i], k, 1)
|
||||
k = k0
|
||||
end while
|
||||
i = j
|
||||
print a$[j]
|
||||
next n
|
||||
Loading…
Add table
Add a link
Reference in a new issue