题目: |
program test3;
var i,j,k,n:integer;
a:array[1..100] of boolean;
begin
read(n);
for i:=1 to n do a[i]:=true;
for i:=1 to n do
begin
j:=i;
while j<=n do
begin
a[j]:=not(a[j]);
j:=j+i;
end;
end;
for i:=1 to n do
if a[i]=true then write('0',' ')
else write('1',' ');
end.
输入:8 输出:1 0 0 1 0 0 0 0
|