Код:
Program P2SS;
type
dss=0..1;
var
P:array[1..10000] of dss;
N,K,I:word;
begin
readln(N);
P[1]:=0;
P[2]:=1;
K:=2;
I:=0;
while N>K+I do
begin
if I=K then
begin
I:=1;
K:=2*K
end
else
I:=I+1;
if P[i]=0 then P[K+I]:=1 else P[K+I]:=0
end;
writeln(P[N]);
readln
end.
All Rights Reserved
Dreamer 2007