var a, b: integer; begin readln(a, b); writeln(System.Math.Sign(a) = System.Math.Sign(b) ? 'Да' : 'Нет'); end.
Или ̶п̶р̶и̶м̶и̶т̶и̶в̶н̶е̶е̶ проще: var a, b: integer; begin readln(a, b); if (a > 0) then a := 1; if (a = 0) then a := 0; if (a < 0) then a := -1; if (b > 0) then b := 1; if (b = 0) then b := 0; if (b < 0) then b := -1; if (a = b) then writeln('Yes') else writeln('No'); end.
Немного ̶у̶п̶р̶о̶̶щ̶̶ё̶н̶н̶ы̶й̶ оптимизированный вариант: var a, b: integer; begin readln(a, b); if (a > 0) then a := 1 else if (a = 0) then a := 0 else a := -1; if (b > 0) then b := 1 else if (b = 0) then b := 0 else b := -1; if (a = b) then writeln('Yes') else writeln('No'); end.
a, b: integer;
begin
readln(a, b);
writeln(System.Math.Sign(a) = System.Math.Sign(b) ? 'Да' : 'Нет');
end.
Или ̶п̶р̶и̶м̶и̶т̶и̶в̶н̶е̶е̶ проще:
var
a, b: integer;
begin
readln(a, b);
if (a > 0) then a := 1;
if (a = 0) then a := 0;
if (a < 0) then a := -1;
if (b > 0) then b := 1;
if (b = 0) then b := 0;
if (b < 0) then b := -1;
if (a = b) then
writeln('Yes')
else
writeln('No');
end.
Немного ̶у̶п̶р̶о̶̶щ̶̶ё̶н̶н̶ы̶й̶ оптимизированный вариант:
var
a, b: integer;
begin
readln(a, b);
if (a > 0) then
a := 1
else
if (a = 0) then
a := 0
else
a := -1;
if (b > 0) then
b := 1
else
if (b = 0) then
b := 0
else
b := -1;
if (a = b) then
writeln('Yes')
else
writeln('No');
end.