Pagini recente » Cod sursa (job #1968345) | Cod sursa (job #386624) | Cod sursa (job #655128) | Cod sursa (job #2535657) | Cod sursa (job #514244)
Cod sursa(job #514244)
const f='ciur.in';g='ciur.out';
nmax=100000000;
var
v:array[1..nmax] of char;
n,i,j,cate:longint;
begin
assign(input,f);reset(input);
assign(output,g);rewrite(output);
read(n);
//cate:=1;
i:=1;
for i:=1 to n do v[i]:='0';
while ((i*i) shl 1)+(i shl 1)<=n do
begin
if v[i]='0' then
begin
j:=((i*i) shl 1)+(i shl 1);
while (j shl 1)+1 <=n do
begin
v[j]:='1';
j:=j+(i shl 1)+1;
end;
end;
i:=i+1;
end;
i:=1;
while 2*i+1<=n do
begin
if v[i]='0' then inc(cate);
i:=i+1;
end;
write(cate);
close(input);close(output);
end.