PROGRAM Tur_2; type mas=array[1..50,1..2] of longint; var f,fr:text; n:byte; flag:boolean; i,k,a_1,a_2,b_1,b_2,j,c1,c:longint; kos:array[1..2] of longint; kocun,kocun_s,p,s:real; toch:mas; a:array[1..50,1..2] of longint; min_x,max_x,min_y,max_y,v,v1,v2,v3:array[1..2] of longint; Function cosunys(var a_1,a_2,b_1,b_2:longint):real; var p,p_1,p_2,p_3,p_4,p_5:longint; Begin p:=a_1*b_1; p_1:=a_2*b_2; p_2:=sqr(a_1); p_3:=sqr(a_2); p_4:=p+p_1; p_5:=p_2+p_3; cosunys:=p_4 / sqrt(p_5); end; Procedure perumetr(var toch:mas; k:longint; var perum:real); var long:real; i:longint; Begin perum:=0; for i:=1 to k-1 do begin long:=sqrt(sqr(toch[i,1]-toch[i+1,1])+sqr(toch[i,2]-toch[i+1,2])); perum:=perum+long; end; End; Procedure plosha(var toch:mas; k:longint; var sq:real); var i:longint; long_1,long_2,long_3,piv:real; Begin sq:=0; for i:=1 to k-1 do begin long_1:=sqrt(sqr(toch[1,1]-toch[i+1,1])+sqr(toch[1,2]-toch[i+1,2])); long_2:=sqrt(sqr(toch[i+1,1]-toch[i+2,1])+sqr(toch[i+1,2]-toch[i+2,2])); long_3:=sqrt(sqr(toch[i+2,1]-toch[1,1])+sqr(toch[i+2,2]-toch[1,2])); piv:=long_1+long_2+long_3; piv:=piv/2; sq:=sq+sqrt(piv * (piv-long_1) * (piv-long_2) * (piv-long_3)); end; End; Begin assign(f,'input10.txt'); assign(fr,'output.txt'); reset(f); readln(f,n); for i:=1 to n do read(f,a[i,1],a[i,2]); close(f); min_x[1]:=a[1,1]; min_y[1]:=a[1,1]; min_x[2]:=a[1,2]; min_y[2]:=a[1,2]; max_x[1]:=a[1,1]; max_y[1]:=a[1,1]; max_x[2]:=a[1,2]; max_y[2]:=a[1,2]; for i:=2 to n do begin if a[i,1] < min_x[1] then begin min_x[1]:=a[i,1]; min_x[2]:=a[i,2]; end; if (a[i,1] = min_x[1])and(a[i,2] < min_x[2]) then begin min_x[1]:=a[i,1]; min_x[2]:=a[i,2]; end; if a[i,1] > max_x[1] then begin max_x[1]:=a[i,1]; max_x[2]:=a[i,2]; end; if (a[i,1] = max_x[1])and(a[i,2] > max_x[2]) then begin max_x[1]:=a[i,1]; max_x[2]:=a[i,2]; end; if a[i,2] < min_y[2] then begin min_y[2]:=a[i,2]; min_y[1]:=a[i,1]; end; if (a[i,2] = min_y[2])and(a[i,1] > min_y[1]) then begin min_y[2]:=a[i,2]; min_y[1]:=a[i,1]; end; if a[i,2] > max_y[2] then begin max_y[2]:=a[i,2]; max_y[1]:=a[i,1]; end; if (a[i,2] = max_y[2])and(a[i,1] < max_y[1]) then begin max_y[2]:=a[i,2]; max_y[1]:=a[i,1]; end; end; toch[1,1]:=min_x[1]; toch[1,2]:=min_x[2]; k:=1; v[1]:=min_x[1]; v1[1]:=min_y[1]; v2[1]:=max_x[1]; v3[1]:=max_y[1]; v[2]:=min_x[2]; v1[2]:=min_y[2]; v2[2]:=max_x[2]; v3[2]:=max_y[2]; for i:=1 to n-1 do for j:=1 to n-i do if a[j,1]>a[j+1,1] then begin c:=a[j,1]; c1:=a[j,2]; a[j,1]:=a[j+1,1]; a[j,2]:=a[j+1,2]; a[j+1,1]:=c; a[j+1,2]:=c1; end else if (a[j,1]=a[j+1,1])and(a[j,2]>a[j+1,2]) then begin c:=a[j,1]; c1:=a[j,2]; a[j,1]:=a[j+1,1]; a[j,2]:=a[j+1,2]; a[j+1,1]:=c; a[j+1,2]:=c1; end; if (v[1]<>v3[1]) or (v[2]<>v3[2]) then BEGIN kocun:=1; flag:=false; while flag=false do begin i:=1; kocun:=1; while i<=n do begin if ((a[i,1]<=max_y[1])and(a[i,2]>min_x[2])and(a[i,1]<>min_x[1]))or ((a[i,1]<=max_y[1])and(a[i,2]>min_x[2])and(a[i,2]<>min_x[2])) then begin a_1:=a[i,1]-min_x[1]; a_2:=a[i,2]-min_x[2]; b_1:=1; b_2:=0; kocun_s:=cosunys(a_1,a_2,b_1,b_2); if kocun_s < kocun then begin kos[1]:=a[i,1]; kos[2]:=a[i,2]; kocun:=kocun_s; end end; inc(i); end; inc(k); toch[k,1]:=kos[1]; toch[k,2]:=kos[2]; min_x[1]:=kos[1]; min_x[2]:=kos[2]; if (kos[1]=v3[1])and(kos[2]=v3[2]) then flag:=true; end; END; if (v3[1]<>v2[1]) or (v3[2]<>v2[2]) then BEGIN kocun:=1; flag:=false; while flag=false do begin i:=1; kocun:=1; while i<=n do begin if ((a[i,1]>max_y[1])and(a[i,2]>=max_x[2])and(a[i,1]<>max_y[1]))or ((a[i,1]>max_y[1])and(a[i,2]>=max_x[2])and(a[i,2]<>max_y[2])) then begin a_1:=a[i,1]-max_y[1]; a_2:=a[i,2]-max_y[2]; b_1:=0; b_2:=-1; kocun_s:=cosunys(a_1,a_2,b_1,b_2); if kocun_s < kocun then begin kos[1]:=a[i,1]; kos[2]:=a[i,2]; kocun:=kocun_s; end end; inc(i); end; inc(k); toch[k,1]:=kos[1]; toch[k,2]:=kos[2]; max_y[1]:=kos[1]; max_y[2]:=kos[2]; if (kos[1]=v2[1])and(kos[2]=v2[2]) then flag:=true; end; END; for i:=1 to n-1 do for j:=1 to n-i do if a[j,1]v1[1]) or (v2[2]<>v1[2]) then BEGIN kocun:=1; flag:=false; while flag=false do begin i:=1; kocun:=1; while i<=n do begin if ((a[i,2]=min_y[1])and(a[i,1]<>max_x[1]))or ((a[i,2]=min_y[1])and(a[i,2]<>max_x[2])) then begin a_1:=a[i,1]-max_x[1]; a_2:=a[i,2]-max_x[2]; b_1:=-1; b_2:=0; kocun_s:=cosunys(a_1,a_2,b_1,b_2); if kocun_s < kocun then begin kos[1]:=a[i,1]; kos[2]:=a[i,2]; kocun:=kocun_s; end end; inc(i); end; inc(k); toch[k,1]:=kos[1]; toch[k,2]:=kos[2]; max_x[1]:=kos[1]; max_x[2]:=kos[2]; if (kos[1]=v1[1])and(kos[2]=v1[2]) then flag:=true; end; END; if (v1[1]<>v[1]) or (v1[2]<>v[2]) then BEGIN kocun:=1; flag:=false; while flag=false do begin i:=1; kocun:=1; while i<=n do begin if ((a[i,1]min_y[1]))or ((a[i,1]min_y[2])) then begin a_1:=a[i,1]-min_y[1]; a_2:=a[i,2]-min_y[2]; b_1:=0; b_2:=1; kocun_s:=cosunys(a_1,a_2,b_1,b_2); if kocun_s < kocun then begin kos[1]:=a[i,1]; kos[2]:=a[i,2]; kocun:=kocun_s; end end; inc(i); end; inc(k); toch[k,1]:=kos[1]; toch[k,2]:=kos[2]; min_y[1]:=kos[1]; min_y[2]:=kos[2]; if (kos[1]=v[1])and(kos[2]=v[2]) then flag:=true; end; END; perumetr(toch,k,p); plosha(toch,k,s); rewrite(fr); writeln(fr,p:0:2); write(fr,s:0:2); close(fr); End. Быстрый ответ: Сохранить в папке "Отправленные" e-mail: freemail@ukr.net реклама: reklama@kiev.ukr.net ©2000 UkrNet Ltd.