Pagini recente » Cod sursa (job #2324198) | Cod sursa (job #1214350) | Rating asd qwdqwd (cristi_430) | Cod sursa (job #1848681) | Cod sursa (job #463508)
Cod sursa(job #463508)
program ciur ;
const
FIN = 'ciur.in';
FOU = 'ciur.out';
MAX = 1 shl 17;
var
N, i, j, sol : longint;
V : array [0 .. MAX] of longint;
f : text;
begin
assign (f, FIN); reset (f);
readln (f, N); close (f);
i := 1;
while (( i * i shl 1 ) + ( i shl 1 ) <= N) do
begin
if ( V[i shr 3] and ( 1 shl ( i and 7 ) ) = 0 ) then
begin
j := ( i * i shl 1 ) + ( i shl 1 ) ;
while ( j shl 1 ) + 1 <= N do
begin
V[j shr 3] := V[j shr 3] or ( 1 shl ( j and 7 ) ) ;
j := j + ( i shl 1 ) + 1 ;
end;
end ;
inc (i);
end;
sol := 1 ; i := 1 ;
while ( ( i shl 1 ) + 1 <= N ) do
begin
if ( V[i shr 3] and ( 1 shl ( i and 7 ) ) = 0 ) then
inc ( sol ) ;
inc (i);
end;
assign (f, FOU); rewrite (f);
writeln(f, sol);
close(f);
end.