Skip to content

Instantly share code, notes, and snippets.

@Show-vars
Last active October 3, 2015 13:43
Show Gist options
  • Save Show-vars/bc825cf26029675d4a92 to your computer and use it in GitHub Desktop.
Save Show-vars/bc825cf26029675d4a92 to your computer and use it in GitHub Desktop.
program x1;
uses
crt;
var
x, y: real;
ans: Boolean;
begin
repeat
write('Input: х = ');
readln(x);
write('Input: y = ');
readln(y);
// Left side
ans := (y <= (-x) - 2.0) and (y <= ((1.0 / 2.0) * x + 1.0)) and (y <= sqrt(-x) - 3.0) and (y >= -sqrt(-x) - 3.0);
// Square
ans := ans or ((y <= (-x) - 2.0) and (x >= (-1.0)) and (x <= 3.5) and (y <= (-2.5)) and (y >= (-5.0)) and not ((y <= sqrt(-x) - 3.0) and (y >= -sqrt(-x) - 3.0)));
// Right side
ans := ans or ((y >= (-x) - 2.0) and (y <= ((1.0 / 2.0) * x + 1.0)) and not ((y >= (-x) - 2.0) and (x >= (-1.0)) and (x <= 3.5) and (y <= (-2.5)) and (y >= (-5.0)))
and (6.25 <= (x - 1.0) * (x - 1.0) + (y - 0.5) * (y - 0.5)) and (6.25 <= (x - 4.5) * ( x - 4.5) + (y + 1.0) * (y + 1.0)));
if (ans) then writeln('Точка принадлежит') else writeln('Не принадлежит');
until false
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment