Ct757
Сообщений: 135
Оценки: 0
Присоединился: 2005-03-29 19:39:30
|
Задачка легкая, в чем проблема? =)
Ладно, держи, когда-то такое делал:
uses Crt; var x, x1, x2, x3: Real; y, y1, y2, y3: Real; a1, b1, c1: Real; a2, b2, c2: Real; a3, b3, c3: Real;
procedure ABC(x1, x2, y1, y2: Real; var a, b, c: Real); begin a:=y2-y1; b:=x1-x2; c:=-a*x1-b*y1; end;
begin ClrScr; Write('x1, y1: '); ReadLn(x1, y1); Write('x2, y2: '); ReadLn(x2, y2); Write('x3, y3: '); ReadLn(x3, y3); Write('x, y: '); ReadLn(x, y); ABC(x1, x2, y1, y2, a1, b1, c1); ABC(x2, x3, y2, y3, a2, b2, c2); ABC(x3, x1, y3, y1, a3, b3, c3); if (a1*x+b1*y+c1=0) and (((x>=x1) and (x<=x2)) or ((x<=x1) and (x>=x2))) then begin WriteLn('HA CTOPOHE'); ReadLn; Halt; end; if (a2*x+b2*y+c2=0) and (((x>=x2) and (x<=x3)) or ((x<=x2) and (x>=x3))) then begin WriteLn('HA CTOPOHE'); ReadLn; Halt; end; if (a3*x+b3*y+c3=0) and (((x>=x3) and (x<=x1)) or ((x<=x3) and (x>=x1))) then begin WriteLn('HA CTOPОHE'); ReadLn; Halt; end; if ((a1*x3+b1*y3+c1)*(a1*x+b1*y+c1)>0) and ((a2*x1+b2*y1+c2)*(a2*x+b2*y+c2)>0) and ((a3*x2+b3*y2+c3)*(a3*x+b3*y+c3)>0) then WriteLn('BHyTpu') else WriteLn('CHAPy}|{u'); ReadLn; end.
|