Data update
This commit is contained in:
parent
35bcdeebf8
commit
74c69a0df6
2427 changed files with 31826 additions and 3468 deletions
|
|
@ -0,0 +1,22 @@
|
|||
proc lookandsay . a$ .
|
||||
s$ = ""
|
||||
c = 1
|
||||
p$ = substr a$ 1 1
|
||||
for i = 2 to len a$
|
||||
if p$ = substr a$ i 1
|
||||
c += 1
|
||||
else
|
||||
s$ &= c & p$
|
||||
p$ = substr a$ i 1
|
||||
c = 1
|
||||
.
|
||||
.
|
||||
s$ &= c & p$
|
||||
swap a$ s$
|
||||
.
|
||||
b$ = 1
|
||||
print b$
|
||||
for k = 1 to 10
|
||||
lookandsay b$
|
||||
print b$
|
||||
.
|
||||
23
Task/Look-and-say-sequence/SETL/look-and-say-sequence.setl
Normal file
23
Task/Look-and-say-sequence/SETL/look-and-say-sequence.setl
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
program looksay;
|
||||
s := "1";
|
||||
loop for i in [1..10] do
|
||||
print(s);
|
||||
s := looksay(s);
|
||||
end loop;
|
||||
|
||||
proc looksay(s);
|
||||
loop for c in s do;
|
||||
if cur /= c then
|
||||
if count /= om then
|
||||
r +:= count + cur;
|
||||
end if;
|
||||
cur := c;
|
||||
count := 1;
|
||||
else
|
||||
count +:= 1;
|
||||
end if;
|
||||
end loop;
|
||||
r +:= count + cur;
|
||||
return r;
|
||||
end proc;
|
||||
end looksay;
|
||||
Loading…
Add table
Add a link
Reference in a new issue