2. 开关问题

program ysf;
var
        n, i, j : integer;
        a : array[1 .. 100] of 0..1;
begin
        readln(n);
        randomize;
        for i := 1 to n do
                a[i] := Random(2);
        //for i := 1 to n do
        //        write(a[i], '  ');
        for i := 1 to n-2 do
        begin
                j := i;
                while j <= n do
                begin
                        a[j] := a[j] xor 1;
                        j := j+3;
                end;

        end;
        //writeln;
        //for i := 1 to n do
        //        write(a[i], '  ');
        //writeln;
        for i := 1 to n do
                if a[i] = 1 then
                        write(i, '  ');
        writeln;
        readln;
end.
posted @ 2010-01-30 19:58  SmartIOI  阅读(109)  评论(0)    收藏  举报
本站采用CC授权如需转载、引用文章,请务必附上作者及来源处。 Creative Commons License