# define RIN exponential (20.0)
# define RON gauss (365,30)
# define N1 gauss (30000,4)
# define VACANCY (-1)
Rand (void)
{unsigned long int u = C; = u * C; u/float (0xfffffffful),
}
NextTime (float tv, float ta [], unsigned int size)
{t = tv; (unsigned int i = 0; i = 0 && ta [i]
}
exponential (float lambda)
{-log (Rand ())/lambda;
}
int discrete ()
{i = 0, A [8] = {90, 120, 150, 180, 210, 240, 270, 365}; x, k, B [8] = {0.05, 0.1, 0.2, 0.2, 0.2, 0.05, 0.05, 0.15};
= Rand (); = B [0];
(k
{+ +; + = B [i];
} A [i];
}
uniform (float a, float b)
{Rand () * (b-a) + a;
}
gauss (float mean, float sigma)
{sqrt (-2 * log (Rand ())) * sin (2 * M_PI * Rand ()) * sigma + mean;
}
main ()
{();
long int i, T_Kred, Otk = 0, Kred = 0; t, tin, ton [Cmax]; Sum_Kred = 0, Sred_Vel, Mec_Doxod = 0, Ob_Doxod = 0, Sum;
(i = 0; i
= RIN;
(t = tin; t <(N * 365); t = NextTime (tin, ton, Cmax))
{(i = 0; i
{[i] = VACANCY; + +;
} (tin == t)
{= 0; ((ton [i]! = VACANCY) && (i
{_Kred = RON; [i] = t + T_Kred; = N1; _Kred + = Sum; _Doxod + = Sum * T_Kred/365 * H/100.0;
} Otk + +; = t + RIN;
}
}
_Vel = Sum_Kred/(N * 365); _Doxod = Ob_Doxod/(N * 12);
<<'' <<"Kolichestvo kreditov =" <
getch ();
}