Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
30
Task/Sudan-function/BCPL/sudan-function.bcpl
Normal file
30
Task/Sudan-function/BCPL/sudan-function.bcpl
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
get "libhdr"
|
||||
|
||||
let sudan(n, x, y) =
|
||||
n = 0 -> x + y,
|
||||
y = 0 -> x,
|
||||
sudan(n-1, sudan(n, x, y-1), sudan(n, x, y-1)+y)
|
||||
|
||||
let showtable(f, n, x, y) be
|
||||
$( writef("sudan(%N,x,y)*N", n)
|
||||
writes(" ")
|
||||
for i=0 to x do writed(i, 5)
|
||||
for i=0 to y
|
||||
$( writef("*N%I4:", i)
|
||||
for j=0 to x do writed(f(n, j, i), 5)
|
||||
$)
|
||||
writes("*N*N")
|
||||
$)
|
||||
|
||||
let show(f, n, x, y) be
|
||||
writef("sudan(%I4,%I4,%I4) = %I6*N", n, x, y, f(n, x, y))
|
||||
|
||||
let start() be
|
||||
$( showtable(sudan, 0, 6, 5)
|
||||
showtable(sudan, 1, 6, 5)
|
||||
wrch('*N')
|
||||
show(sudan, 1, 3, 3)
|
||||
show(sudan, 2, 1, 1)
|
||||
show(sudan, 2, 2, 1)
|
||||
show(sudan, 3, 1, 1)
|
||||
$)
|
||||
Loading…
Add table
Add a link
Reference in a new issue