program dom2;
var
m,i,j,k,l,q,w,e,r,p:integer;
x,y:array[1..100] of real;
o:array[1..2,1..4] of real;
s,s1,a,b,c,d,f,g,h:real;
pri,prim:boolean;
x1,x2,x3,x4,y1,y2,y3,y4:real;
begin
writeln('nahogdenie iz tochek, chtobi ploshadb paralelogram');
writeln('s vershinami v etih tochkah bil MAX');
repeat
writeln('vvedite kolichestvo tochek');
read(m);
if (m<4) or (m>100) then
writeln('nevernoe chislo');
until (m>=4) and (m<=100);
i:=0;
repeat
i:=i+1;
p:=0;
writeln('Vvedite to4ki',I,'tochka');
readln(x[i],y[i]);
if i>1 then
begin
j:=0;
repeat
j:=j+1;
if (x[i]=x[j]) and (y[i]=y[j]) then
begin
writeln ('takaia tochka est');
p:=1;
end;
until (p=1) or (j=i-1);
end;
i:=i-p;
until i=m;
p:=0;
s1:=0;
s:=0;
for i:=1 to m-3 do
for j:= i+1 to m-2 do
for k:=j+1 to m-1 do
for l:= k+1 to m do
if (x[l]-x[i])*(y[j]-y[i])<>(y[l]-y[i])*(x[j]-x[i]) then
begin
pri:=true;
a:=sqrt(sqr(x[i]-x[j])+sqr(y[i]-y[j]));
b:=sqrt(sqr(x[j]-x[k])+sqr(y[j]-y[k]));
c:=sqrt(sqr(x[k]-x[l])+sqr(y[k]-y[l]));
d:=sqrt(sqr(x[l]-x[i])+sqr(y[l]-y[i]));
f:=sqrt(sqr(x[i]-x[k])+sqr(y[i]-y[k]));
g:=sqrt(sqr(x[j]-x[l])+sqr(y[j]-y[l]));
h:=sqrt(sqr(y[j]-y[i]));
if (a=c) and (b=d) then
begin
prim:=true;
s1:=a*h;
if s1>s then
begin
s:=s1;
q:=i;
w:=j;
e:=k;
r:=l;
end;
end;
end;
x1:=x[q];
x2:=x[w];
x3:=x[e];
x4:=x[r];
y1:=y[q];
y2:=y[w];
y3:=y[e];
y4:=y[r];
if (pri) and (prim) then
begin
Writeln('Parallelogramm imeet MAX S');
writeln('T',Q,',',X[Q]:4:1,y[q]:4:1);
writeln('T',W,',',X[W]:4:1,y[W]:4:1);
writeln('T',E,',',X[E]:4:1,y[E]:4:1);
writeln('T',R,',',X[R]:4:1,y[R]:4:1);
end;
if (pri=false) and (prim=false) then
writeln('paralelogramma net');
end.
М | С тегами лучше выглядит, правда? volvo |