function GetMax(A, B: integer): integer;
begin
if (A > 0) and (B> 0) then
begin
if Max(A, B) >= 2*Min(A, B) then
Result := Min(A, B)
else
Result := Round(Max(A, B) / 2);
end else
begin
Result := -1;
end;
end;
function GetMax(A, B: integer): integer;
begin
if (A > 0) and (B> 0) then
begin
if Max(A, B) >= 2*Min(A, B) then
Result := Min(A, B)
else
Result := Integer(Max(A, B) / 2 + 0.5);
end else
begin
Result := -1;
end;
end;
function GetMax(A, B: integer): integer;
begin
if (A > 0) and (B> 0) then
begin
if Max(A, B) >= 2*Min(A, B) then
Result := Min(A, B)
else
Result := Trunc(Max(A, B) / 2 + 0.5);
end else
begin
Result := -1;
end;
end;
function GetMax(A, B: integer): integer;
begin
if A shr 1>=B then result:=B
else if B shr 1>=A then result:=A
else result:=(A+B) div 3;
end;