e C (125 * 125 * 125 * 125 * 5ul)
# define N 5
# define H 20.0
# define Cmax 100
# define RIN ceil (exponential (1.0/7.0))
# define RON discrete ()
# define N1 uniform (+100000,10000000)
Rand (void)
{unsigned long int u = C; = u * C; u/float (0xfffffffful);
}
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;
}
main ()
{();
i, t, T_Kred, tin, ton [Cmax], Otk = 0, Kred = 0; Sum_Kred = 0, Sred_Vel, Mec_Doxod = 0, Ob_Doxod = 0, Sum;
(i = 0; i
= RIN;
(t = 0; t <(N * 365); t + +)
{(i = 0; i
{[i] = -1; + +;
} (tin == t)
{= 0; ((ton [i]! = -1) && (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 =" <
();
}
Додаток 2
# include
# include
# include
# include
# include
# include
# define C (125 * 125 * 125 * 125 * 5ul)
# define N 5
# define H 20.0
# define Cmax 10000...