for Y:= 1 to N do
begin
inc(pom_X);
for X:= 2 to N do
begin
if pom+pom_Y=N-1 then inc(Xt);
if Xt=0 then inc(pom);
if Xt=2 then dec(pom);
pole[X,Y]:=pole[X-1,Y]+pom+pom_Y;
end;
Xt:=0;
pom:=0;
inc(pom_Y);
if Y+1<=N then
pole[1,Y+1]:=pole[1,Y]+pom_X;
end;
For Y:=1 to N do
For X:=1 to N do
begin
Gotoxy(X*3,Y);
Write(pole[X,Y]);
end;
readkey;
end.