program hash1_2; uses simpleHash in 'simpleHash.pas'; const cHexChars: array [0..15] of char = '0123456789abcdef'; cNullStr: PChar = '00000000'; function hexStr(i: cardinal): string; var n: integer; begin if i=0 then result:='0' else begin setString(result,cNullStr,8); n:=8; while (i>0) do begin result[n]:=cHexChars[i and $f]; i:=i shr 4; dec(n); end; for n:=1 to 8 do if result[n]<>'0' then begin delete(result,1,n-1); exit; end; end; end; var h: TStringHash; n, Count, i: cardinal; code: integer; s: string; begin n :=1; if ParamCount=1 then Val(ParamStr(1),n,code); h:=TStringHash.Create; for i:=1 to n do h.add(hexStr(i),i); count:=0; for i:=1 to n do begin str(i,s); if h.get(s)<>nil then inc(Count); end; h.Destroy; writeln(Count); end.