Minimum number of cells after, before, above and below NxN squares: Difference between revisions

Added XPL0 example.
(Added 11l)
(Added XPL0 example.)
Line 2,353:
Minimum number of cells after, before, above and below 1 x 1 square:
0
</pre>
 
=={{header|XPL0}}==
<lang XPL0>func Min(A, B);
int A, B;
return if A<B then A else B;
 
def N=10, M=N-1, C=M/2;
int X, Y, VX, VY;
[for Y:= 0 to M do
[for X:= 0 to M do
[VX:= if X <= C then X else M-X;
VY:= if Y <= C then Y else M-Y;
IntOut(0, Min(VX, VY)); ChOut(0, ^ );
];
CrLf(0);
];
]</lang>
 
{{out}}
<pre>
0 0 0 0 0 0 0 0 0 0
0 1 1 1 1 1 1 1 1 0
0 1 2 2 2 2 2 2 1 0
0 1 2 3 3 3 3 2 1 0
0 1 2 3 4 4 3 2 1 0
0 1 2 3 4 4 3 2 1 0
0 1 2 3 3 3 3 2 1 0
0 1 2 2 2 2 2 2 1 0
0 1 1 1 1 1 1 1 1 0
0 0 0 0 0 0 0 0 0 0
</pre>
772

edits