program green; var tchk,newtchk,tchkm:array [1..12,1..2] of real; pass:set of byte; ok:boolean; f:text; i,i1,i2,i3,i4,n,pos:integer; s,a1,a2,b1,b2:real; {koordunatu peretuny dvox vidrizkiv,jakchsho vonu peretunajytsa ,obchusljujutcja metodom Kramera} Function Peretin (x11,y11,x12,y12,x21,y21,x22,y22:real;var x,y:real): boolean; {perevirka nalewnosti tochku prjamokytnuky,dlja jakogo vidrizok je diagonaljy} Function Naleg(xk,yk,x1,y1,x2,y2:real):boolean; var xl,yl,xh,yh:real; begin if x1=xl) and(xk<=xh)and(yk>=yl)and(yk<=yh)); end; begin peretin:=false; a1:=x12-x11; a2:=y12-y11; b1:=x22-x21; b2:=y22-y21; s:=a1*b2-a2*b1; if s=0 then exit;{ymova paralelnosti prjamux} if abs(a2)>abs(a1) then begin y:=(a1*b2*y11-a2*b2*(x11-x21)-a2*b1*y21)/s; x:=a1/a2*(y-y11)+x11 end else begin x:=-(a2*b1*x11-a1*b1*(y11-y21)-a1*b2*x21)/s; y:=a2/a1*(x-x11)+y11 end; Peretin:=(NALEG(x,y,x11,y11,x12,y12)) and(Naleg(x,y,x21,y21,x22,y22)); end; {obchuslennja s n-kytnuka} Function PLOSCHa(col:integer):real; var i,i1:integer; s:real; begin s:=0; for i:=1 to col do begin if i0 then begin for i1:=n to pos-1 do newtchk[i1]:=newtchk[i1+1]; dec(pos); end; until n=0; until i>=pos; if pos>=3 then begin {vuznachajemo porjadok obxody verschun mnogokytnuka} pass:=[1]; tchkm[1]:=newtchk[1]; n:=1; repeat ok:=true; for i:=1 to pos do if(not(i in pass)) and(ok) then begin a1:=newtchk[i,1]-tchkm[n,1]; a2:=newtchk[i,2]-tchkm[n,2]; i3:=0; i4:=0; for i1:=1 to pos do begin s:=(newtchk[i1,1]-tchkm[n,1])*a2- (newtchk[i2,2]-tchkm[n,2])*a1; if s<-0.000000001 then inc(i3); if s>0.000000001 then inc(i4); end; if not((i3>0) and (i4>0)) then begin inc(n); pass:=pass+[i]; tchkm[n]:=newtchk[i]; ok:=false end; end; until n=pos; s:=PLOSCHA(pos); end else s:=0; assign(f,'green.sol') ; rewrite(f); writeln(f,s:1:2); writeln(f,pos); close(f); writeln('pljama maje verschunu-',pos,'.'); writeln('ploscha pljamu-',s:1:2); readln; end.