Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,11 +0,0 @@
|
|||
package Pascal is
|
||||
|
||||
type Row is array (Natural range <>) of Natural;
|
||||
|
||||
function Length(R: Row) return Positive;
|
||||
|
||||
function First_Row(Max_Length: Positive) return Row;
|
||||
|
||||
function Next_Row(R: Row) return Row;
|
||||
|
||||
end Pascal;
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
package body Pascal is
|
||||
|
||||
function First_Row(Max_Length: Positive) return Row is
|
||||
R: Row(0 .. Max_Length) := (0 | 1 => 1, others => 0);
|
||||
begin
|
||||
return R;
|
||||
end First_Row;
|
||||
|
||||
function Next_Row(R: Row) return Row is
|
||||
S: Row(R'Range);
|
||||
begin
|
||||
S(0) := Length(R)+1;
|
||||
S(Length(S)) := 1;
|
||||
for J in reverse 2 .. Length(R) loop
|
||||
S(J) := R(J)+R(J-1);
|
||||
end loop;
|
||||
S(1) := 1;
|
||||
return S;
|
||||
end Next_Row;
|
||||
|
||||
function Length(R: Row) return Positive is
|
||||
begin
|
||||
return R(0);
|
||||
end Length;
|
||||
|
||||
end Pascal;
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Command_Line, Pascal; use Pascal;
|
||||
|
||||
procedure Triangle is
|
||||
|
||||
Number_Of_Rows: Positive := Integer'Value(Ada.Command_Line.Argument(1));
|
||||
Row: Pascal.Row := First_Row(Number_Of_Rows);
|
||||
|
||||
begin
|
||||
loop
|
||||
-- print one row
|
||||
for J in 1 .. Length(Row) loop
|
||||
Ada.Integer_Text_IO.Put(Row(J), 5);
|
||||
end loop;
|
||||
Ada.Text_IO.New_Line;
|
||||
exit when Length(Row) >= Number_Of_Rows;
|
||||
Row := Next_Row(Row);
|
||||
end loop;
|
||||
end Triangle;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
pascalTriangle: function [n][
|
||||
triangle: new [[1]]
|
||||
triangle: [[1]]
|
||||
|
||||
loop 1..dec n 'x [
|
||||
'triangle ++ @[map couple (last triangle)++[0] [0]++(last triangle) 'x -> x\[0] + x\[1]]
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
(require 'cl-lib)
|
||||
|
||||
(defun next-row (row)
|
||||
(cl-mapcar #'+ (cons 0 row)
|
||||
(append row '(0))))
|
||||
|
||||
(defun triangle (row rows)
|
||||
(if (= rows 0)
|
||||
'()
|
||||
(cons row (triangle (next-row row) (- rows 1)))))
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
(defun pascal (r)
|
||||
(dotimes (i r)
|
||||
(let ((c 1))
|
||||
(dotimes (k (+ i 1))
|
||||
(princ (format "%d " c))
|
||||
(setq c (/ (* c (- i k))
|
||||
(+ k 1))))
|
||||
(terpri))))
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
(defun pascal (r)
|
||||
(let ((out ""))
|
||||
(dotimes (i r)
|
||||
(let ((c 1))
|
||||
(dotimes (k (+ i 1))
|
||||
(setq out (concat out (format "%d " c)))
|
||||
(setq c (/ (* c (- i k))
|
||||
(+ k 1))))
|
||||
(setq out (concat out "\n"))))
|
||||
out))
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
sequence row
|
||||
row = {}
|
||||
for m = 1 to 10 do
|
||||
row = row & 1
|
||||
for n = length(row)-1 to 2 by -1 do
|
||||
row[n] += row[n-1]
|
||||
end for
|
||||
print(1,row)
|
||||
puts(1,'\n')
|
||||
end for
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
$Infinity = 1
|
||||
$NewNumbers = $null
|
||||
$Numbers = $null
|
||||
$Result = $null
|
||||
$Number = $null
|
||||
$Power = $args[0]
|
||||
|
||||
Write-Host $Power
|
||||
|
||||
For(
|
||||
$i=0;
|
||||
$i -lt $Infinity;
|
||||
$i++
|
||||
)
|
||||
{
|
||||
$Numbers = New-Object Object[] 1
|
||||
$Numbers[0] = $Power
|
||||
For(
|
||||
$k=0;
|
||||
$k -lt $NewNumbers.Length;
|
||||
$k++
|
||||
)
|
||||
{
|
||||
$Numbers = $Numbers + $NewNumbers[$k]
|
||||
}
|
||||
If(
|
||||
$i -eq 0
|
||||
)
|
||||
{
|
||||
$Numbers = $Numbers + $Power
|
||||
}
|
||||
$NewNumbers = New-Object Object[] 0
|
||||
Try
|
||||
{
|
||||
For(
|
||||
$j=0;
|
||||
$j -lt $Numbers.Length;
|
||||
$j++
|
||||
)
|
||||
{
|
||||
$Result = $Numbers[$j] + $Numbers[$j+1]
|
||||
$NewNumbers = $NewNumbers + $Result
|
||||
}
|
||||
}
|
||||
Catch [System.Management.Automation.RuntimeException]
|
||||
{
|
||||
Write-Warning "Value was too large for a Decimal. Script aborted."
|
||||
Break;
|
||||
}
|
||||
Foreach(
|
||||
$Number in $Numbers
|
||||
)
|
||||
{
|
||||
If(
|
||||
$Number.ToString() -eq "+unendlich"
|
||||
)
|
||||
{
|
||||
Write-Warning "Value was too large for a Decimal. Script aborted."
|
||||
Exit
|
||||
}
|
||||
}
|
||||
Write-Host $Numbers
|
||||
$Infinity++
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
Pascal_Triangle(WScript.Arguments(0))
|
||||
Function Pascal_Triangle(n)
|
||||
Dim values(100)
|
||||
values(1) = 1
|
||||
WScript.StdOut.Write values(1)
|
||||
WScript.StdOut.WriteLine
|
||||
For row = 2 To n
|
||||
For i = row To 1 Step -1
|
||||
values(i) = values(i) + values(i-1)
|
||||
WScript.StdOut.Write values(i) & " "
|
||||
Next
|
||||
WScript.StdOut.WriteLine
|
||||
Next
|
||||
End Function
|
||||
Loading…
Add table
Add a link
Reference in a new issue