.


           


{ 蠠 }

Procedure NumberExperiment(e, PP : real; var n : longint);

var

x : real;

begin

n := 0;

repeat

n := n + 1; x := 2*e*sqrt(n)

until FF(x) >= PP

end;

{----------------------------------------------------------------------------------------}

begin

randomize;

write(' - a = '); readln(a);

write(' b A '); readln(b);

write(' '); readln(PP);

write(' '); readln(e);

NumberExperiment(e, PP, n);

m := 0;

for i := 1 to n do

begin

x := random*a; y := random*a;

if (x <= b) and (y <= b) then m := m + 1

end;

p := m/n;

writeln(' ', p:6:4);

writeln(' ', e:1:6);

writeln(' ', PP:1:4);

writeln(' ', n)

end.

Program Task16_2;

uses WinCrt;

var

x, y, p, a, q, k1, h, e, pp : real;

i, n, k, m : longint;

{----------------------------------------------------------------------------------------}

{ 頠 }

{ 0 x. - }

Function FF(x : real) : real;

var

n : integer;

u, I : real;

begin

if x >= 5

then FF := 1

else if x <= -5

then FF := -1

else

begin

u := x; n := 0; I := 0;

repeat

I := I + u; n := n + 1;

u := -u*(x*x*(2*n - 1)/(2*n*(2*n + 1)))

until abs(u) < 0.00001;

FF := 2*I/sqrt(2*Pi)