2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -0,0 +1,67 @@
Program zigzag( input, output );
const
size = 5;
var
zzarray: array [1..size, 1..size] of integer;
element, i, j: integer;
direction: integer;
width, n: integer;
begin
i := 1;
j := 1;
direction := 1;
for element := 0 to (size*size) - 1 do
begin
zzarray[i,j] := element;
i := i + direction;
j := j - direction;
if (i = 0) then
begin
direction := -direction;
i := 1;
if (j > size) then
begin
j := size;
i := 2;
end;
end
else if (i > size) then
begin
direction := -direction;
i := size;
j := j + 2;
end
else if (j = 0) then
begin
direction := -direction;
j := 1;
if (i > size) then
begin
j := 2;
i := size;
end;
end
else if (j > size) then
begin
direction := -direction;
j := size;
i := i + 2;
end;
end;
width := 2;
n := size;
while (n > 0) do
begin
width := width + 1;
n := n div 10;
end;
for j := 1 to size do
begin
for i := 1 to size do
write(zzarray[i,j]:width);
writeln;
end;
end.

View file

@ -0,0 +1,40 @@
Program zigzag;
{$APPTYPE CONSOLE}
const
size = 5;
var
s: array [1..size, 1..size] of integer;
i, j, d, max, n: integer;
begin
i := 1;
j := 1;
d := -1;
max := 0;
n := 0;
max := size * size;
for n := 1 to (max div 2)+1 do begin
s[i,j] := n;
s[size - i + 1,size - j + 1] := max - n + 1;
i:=i+d;
j:=j-d;
if i < 1 then begin
inc(i);
d := -d;
end else if j < 1 then begin
inc(j);
d := -d;
end;
end;
for j := 1 to size do
begin
for i := 1 to size do
write(s[i,j]:4);
writeln;
end;
end.

View file

@ -1,49 +0,0 @@
Program zigzag;
const
size = 5;
var
zzarray: array [1..size, 1..size] of integer;
element, i, j: integer;
direction: integer;
begin
i := 1;
j := 1;
direction := 1;
for element := 1 to size*size do
begin
zzarray[i,j] := element;
i := i + direction;
j := j - direction;
if (i = 0) then
begin
direction := -direction;
i := i + 1;
end;
if (i = size +1) then
begin
direction := -direction;
i := i - 1;
j := j + 2;
end;
if (j = 0) then
begin
direction := -direction;
j := j + 1;
end;
if (j = size + 1) then
begin
direction := -direction;
j := j - 1;
i := i + 2;
end;
end;
for j := 1 to size do
begin
for i := 1 to size do
write(zzarray[i,j]:3);
writeln;
end;
end.