8. 试找出1, 2, 3, 4, 5里3个数的组合。

program exExhaustive8_1;
const b = 1; e = 5;
var
     f, s, t : integer;
begin
     for t := b to e do
         for s := b to e do
             for f := b to e do
                 if (t <> s) and (t <> f) and (s <> f) then write(t*100+s*10+f, ' ');
     readln;
end.


program exExhaustive8_2;
const b = 1; e = 5;
var
     f, s, t : integer;
begin
     for t := b to e-2 do
         for s := t+1 to e-1 do
             for f := s+1 to e do
                    write(t*100+s*10+f, ' ');
     readln;
end.

posted @ 2010-01-01 21:06  SmartIOI  阅读(130)  评论(0)    收藏  举报
本站采用CC授权如需转载、引用文章,请务必附上作者及来源处。 Creative Commons License