Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,13 +0,0 @@
|
|||
with Ada.Text_IO, Ada.Strings.Fixed;
|
||||
use Ada.Text_IO, Ada.Strings, Ada.Strings.Fixed;
|
||||
|
||||
function "+" (S : String) return String is
|
||||
Item : constant Character := S (S'First);
|
||||
begin
|
||||
for Index in S'First + 1..S'Last loop
|
||||
if Item /= S (Index) then
|
||||
return Trim (Integer'Image (Index - S'First), Both) & Item & (+(S (Index..S'Last)));
|
||||
end if;
|
||||
end loop;
|
||||
return Trim (Integer'Image (S'Length), Both) & Item;
|
||||
end "+";
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
Put_Line (+"1");
|
||||
Put_Line (+(+"1"));
|
||||
Put_Line (+(+(+"1")));
|
||||
Put_Line (+(+(+(+"1"))));
|
||||
Put_Line (+(+(+(+(+"1")))));
|
||||
Put_Line (+(+(+(+(+(+"1"))))));
|
||||
Put_Line (+(+(+(+(+(+(+"1")))))));
|
||||
Put_Line (+(+(+(+(+(+(+(+"1"))))))));
|
||||
Put_Line (+(+(+(+(+(+(+(+(+"1")))))))));
|
||||
Put_Line (+(+(+(+(+(+(+(+(+(+"1"))))))))));
|
||||
|
|
@ -2,17 +2,16 @@ lookAndSay: function [n][
|
|||
if n=0 -> return "1"
|
||||
previous: lookAndSay n-1
|
||||
|
||||
result: new ""
|
||||
result: ""
|
||||
currentCounter: 0
|
||||
currentCh: first previous
|
||||
loop previous 'ch [
|
||||
if? currentCh <> ch [
|
||||
switch currentCh <> ch [
|
||||
if not? zero? currentCounter ->
|
||||
'result ++ (to :string currentCounter) ++ currentCh
|
||||
currentCounter: 1
|
||||
currentCh: ch
|
||||
]
|
||||
else ->
|
||||
]->
|
||||
currentCounter: currentCounter + 1
|
||||
]
|
||||
'result ++ (to :string currentCounter) ++ currentCh
|
||||
|
|
|
|||
|
|
@ -1,43 +0,0 @@
|
|||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. LOOK-AND-SAY-SEQ.
|
||||
|
||||
DATA DIVISION.
|
||||
WORKING-STORAGE SECTION.
|
||||
01 SEQUENCES.
|
||||
02 CUR-SEQ PIC X(80) VALUE "1".
|
||||
02 CUR-CHARS REDEFINES CUR-SEQ
|
||||
PIC X OCCURS 80 TIMES INDEXED BY CI.
|
||||
02 CUR-LENGTH PIC 99 COMP VALUE 1.
|
||||
02 NEXT-SEQ PIC X(80).
|
||||
02 NEXT-CHARS REDEFINES NEXT-SEQ
|
||||
PIC X OCCURS 80 TIMES INDEXED BY NI.
|
||||
01 ALG-STATE.
|
||||
02 STEP-AMOUNT PIC 99 VALUE 14.
|
||||
02 ITEM-COUNT PIC 9.
|
||||
|
||||
PROCEDURE DIVISION.
|
||||
LOOK-AND-SAY.
|
||||
DISPLAY CUR-SEQ.
|
||||
SET CI TO 1.
|
||||
SET NI TO 1.
|
||||
MAKE-NEXT-ENTRY.
|
||||
MOVE 0 TO ITEM-COUNT.
|
||||
IF CI IS GREATER THAN CUR-LENGTH GO TO STEP-DONE.
|
||||
TALLY-ITEM.
|
||||
ADD 1 TO ITEM-COUNT.
|
||||
SET CI UP BY 1.
|
||||
IF CI IS NOT GREATER THAN CUR-LENGTH
|
||||
AND CUR-CHARS(CI) IS EQUAL TO CUR-CHARS(CI - 1)
|
||||
GO TO TALLY-ITEM.
|
||||
INSERT-ENTRY.
|
||||
MOVE ITEM-COUNT TO NEXT-CHARS(NI).
|
||||
MOVE CUR-CHARS(CI - 1) TO NEXT-CHARS(NI + 1).
|
||||
SET NI UP BY 2.
|
||||
GO TO MAKE-NEXT-ENTRY.
|
||||
STEP-DONE.
|
||||
MOVE NEXT-SEQ TO CUR-SEQ.
|
||||
SET NI DOWN BY 1.
|
||||
SET CUR-LENGTH TO NI.
|
||||
SUBTRACT 1 FROM STEP-AMOUNT.
|
||||
IF STEP-AMOUNT IS NOT EQUAL TO ZERO GO TO LOOK-AND-SAY.
|
||||
STOP RUN.
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
using Std;
|
||||
|
||||
class Main
|
||||
{
|
||||
|
||||
static function main()
|
||||
{
|
||||
var test = "1";
|
||||
for (i in 0...11) {
|
||||
Sys.println(test);
|
||||
test = lookAndSay(test);
|
||||
}
|
||||
}
|
||||
|
||||
static function lookAndSay(s:String)
|
||||
{
|
||||
if (s == null || s == "") return "";
|
||||
|
||||
var results = "";
|
||||
var repeat = s.charAt(0);
|
||||
var amount = 1;
|
||||
for (i in 1...s.length)
|
||||
{
|
||||
var actual = s.charAt(i);
|
||||
if (actual != repeat)
|
||||
{
|
||||
results += amount.string();
|
||||
results += repeat;
|
||||
repeat = actual;
|
||||
amount = 0;
|
||||
}
|
||||
amount++;
|
||||
}
|
||||
results += amount.string();
|
||||
results += repeat;
|
||||
|
||||
return results;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
function Get-LookAndSay ($n = 1) {
|
||||
$re = [regex] '(.)\1*'
|
||||
$ret = ""
|
||||
foreach ($m in $re.Matches($n)) {
|
||||
$ret += [string] $m.Length + $m.Value[0]
|
||||
}
|
||||
return $ret
|
||||
}
|
||||
|
||||
function Get-MultipleLookAndSay ($n) {
|
||||
if ($n -eq 0) {
|
||||
return @()
|
||||
} else {
|
||||
$a = 1
|
||||
$a
|
||||
for ($i = 1; $i -lt $n; $i++) {
|
||||
$a = Get-LookAndSay $a
|
||||
$a
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
function looksay( n )
|
||||
dim i
|
||||
dim accum
|
||||
dim res
|
||||
dim c
|
||||
res = vbnullstring
|
||||
do
|
||||
if n = vbnullstring then exit do
|
||||
accum = 0
|
||||
c = left( n,1 )
|
||||
do while left( n, 1 ) = c
|
||||
accum = accum + 1
|
||||
n = mid(n,2)
|
||||
loop
|
||||
if accum > 0 then
|
||||
res = res & accum & c
|
||||
end if
|
||||
loop
|
||||
looksay = res
|
||||
end function
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
dim m
|
||||
m = 1
|
||||
for i = 0 to 13
|
||||
m = looksay(m)
|
||||
wscript.echo m
|
||||
next
|
||||
Loading…
Add table
Add a link
Reference in a new issue