17,378
社区成员
发帖
与我相关
我的任务
分享
set serveroutput on
declare
h pls_integer;
i pls_integer;
j pls_integer;
r pls_integer;
l pls_integer;
b pls_integer;
d pls_integer;
pl pls_integer;
begin
h:=&height;
for i in 1..h loop
for j in 1..h loop
r:=i; d:=0; pl:=j-r;
if (r>h-j+1) then
r:=h-j+1; d:=1; pl:=i-r;
end if;
if (r>h-i+1) then
r:=h-i+1; d:=2; pl:=h-j+1-r;
end if;
if (r>j) then
r:=j; d:=3; pl:=h-i+1-r;
end if;
l:=h-2*(r-1)-1;
b:=(4*h-4)*(r-1)-4*(r-1)*(r-2)+1;
dbms_output.put(to_char(b+l*d+pl,'9999'));
end loop;
dbms_output.new_line;
end loop;
end;
/