data output;
array ar(8) a b c d e f g h;
do a=1 to 4;
do b=8 to 5 by -1;
do c=1 to 3;
do d=6 to 4 by -1;
do e=8 to 2 by -1;
do f=7 to 1 by -1;
do g=8 to 4 by -1;
do h=5 to 1 by -1;
Same=0;
do i=1 to 7;
do j=i+1 to 8;
if ar(i)=ar(j) then
Same=1;
end;
end;
if Same=0 and
a+b=9 and
c+d=7 and
e-f=1 and
g-h=3
then output;
drop i j Same;
end;
end;
end;
end;
end;
end;
end;
end;
run;作者: BioSas 时间: 2016-5-16 03:38
注:
上面用于纸笔计算的表格可以帮助编程时减少循环次数,大大提高计算机解题速度。比如:
do a=1 to 4
而非:
do a=1 to 8