Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
38
Task/Sudan-function/Draco/sudan-function.draco
Normal file
38
Task/Sudan-function/Draco/sudan-function.draco
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
proc sudan(word n, x, y) word:
|
||||
word k;
|
||||
if n=0 then
|
||||
x + y
|
||||
elif y=0 then
|
||||
x
|
||||
else
|
||||
k := sudan(n, x, y-1);
|
||||
sudan(n-1, k, k+y)
|
||||
fi
|
||||
corp
|
||||
|
||||
proc table(word n, xs, ys) void:
|
||||
word x, y;
|
||||
writeln("sudan(",n,",x,y):");
|
||||
write(" ");
|
||||
for x from 0 upto xs do write(x:5) od;
|
||||
for y from 0 upto ys do
|
||||
writeln();
|
||||
write(y:4, ":");
|
||||
for x from 0 upto xs do write(sudan(n,x,y):5) od;
|
||||
od;
|
||||
writeln();
|
||||
writeln()
|
||||
corp
|
||||
|
||||
proc show(word n, x, y) void:
|
||||
writeln("sudan(", n:1, ",", x:3, ",", y:3, ") = ", sudan(n,x,y):5)
|
||||
corp
|
||||
|
||||
proc main() void:
|
||||
table(0, 6, 5);
|
||||
table(1, 6, 5);
|
||||
show(1, 3, 3);
|
||||
show(2, 1, 1);
|
||||
show(2, 2, 1);
|
||||
show(3, 1, 1)
|
||||
corp
|
||||
Loading…
Add table
Add a link
Reference in a new issue