uses crt; const divider = 200; delta = 1/ divider; var sum, none: longint; tm_s, tm_f: longint; var found: boolean; n,i: integer; S2, S1, point_x, point_y, miny, maxy, minx, maxx, r: double; mas: array[1..50] of double; x, y: array[1 .. 50] of double; begin Clrscr; Write('circles amount: '); ReadLn(n); WriteLn('Rs: '); minx:=0; maxx:=0; miny:=0; maxy:=0; for i:=1 to n do readln(mas[i]); for i:=1 to n do begin x[i]:=mas[i]*(cos(2*pi/n*(i-1))); y[i]:=mas[i]*(sin(2*pi/n*(i-1))); writeln(x[i]:2:2,' ',y[i]:2:2); if x[i]-mas[i]<=minx then minx:=x[i]-mas[i]; if x[i]+mas[i]>=maxx then maxx:=x[i]+mas[i]; if y[i]-mas[i]<=miny then miny:=y[i]-mas[i]; if y[i]+mas[i]>=maxy then maxy:=y[i]+mas[i]; end; writeln(minx:2:2,' ',maxx:2:2,' ',miny:2:2,' ',maxy:2:2); S1:=(abs(minx)+abs(maxx))*(abs(miny)+abs(maxy)); writeln('S of rectangle = ',S1:2:2); sum:=0; none := 0; tm_s:= MemL[$0040:$006c]; for i := 1 to n do mas[i] := sqr(mas[i]); point_x := minx; while point_x <= maxx do begin point_y := miny; while point_y <= maxy do begin i := 1; found := False; While (i <= n) and not found do if (sqr(point_x-x[i])+sqr(point_y-y[i])) <= mas[i] then found := true else inc(i); if found then inc(sum) else inc(none); point_y := point_y + delta; end; point_x := point_x + delta; end; tm_f:= MemL[$0040:$006c]; tm_f:=tm_f - tm_s; writeln('time: ', tm_f); writeln('inside: ', sum, ' outside: ', none); S2:=S1*(sum/(sum+none)); writeln('S = ',S2:2:2); end.