Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <vector>
- #include <map>
- #include <set>
- #include <complex>
- #include <ctime>
- #include <iostream>
- #include <cmath>
- #include <stack>
- #include <sstream>
- #include <stdio.h>
- #include <algorithm>
- #include <queue>
- #include <cstring>
- #include <cassert>
- #include <iomanip>
- #include <math.h>
- using namespace std;
- long double fak(int n)
- {
- long double f = 1;
- for (int i = 1; i <= n; i++)
- {
- f *= i;
- }
- return f;
- }
- int main() {
- ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
- srand(unsigned(time(nullptr)));
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- long double la = 40;
- long double n = 16;
- long double t = 1.0/3.0;
- long double mu = 1.0 / t;
- long double ro = la / mu;
- long double ro0 = 1;
- for (int i = 1; i <= n; i++)
- {
- ro0 += pow(ro, i) / fak(i);
- }
- ro0 = 1.0 / ro0;
- cout << "Интенсивность потока обслуживания: " << mu << endl;
- cout << "Коэффициент загрузки канала: " << ro << endl;
- for (int i = 0; i <= n; i++)
- {
- cout << "ro" << i << " = ";
- if (i == 0)
- {
- cout << ro0 << endl;
- continue;
- }
- long double r = ro0 * pow(ro, i) / fak(i);
- cout << r << endl;
- }
- long double r_otk = ro0 * pow(ro, n) / fak(n);
- cout << "Вероятность отказа в обслуживании: " << r_otk << endl;
- long double Q = 1 - r_otk;
- cout << "Относительная пропускная способность СМО: " << Q << endl;
- long double A = la * Q;
- cout << "Абсолютная пропускная способность СМО: " << A << endl;
- long double t_pr = r_otk * t;
- cout << "Средняя доля времени простоя СМО: " << t_pr << endl;
- long double k_ = A / mu;
- cout << "Среднее число занятых каналов: " << k_ << endl;
- long double Ts = (1.0 / la) * k_;
- cout << "Среднее время пребывания одной заявки в системе (по формуле Литтла): " << Ts << endl;
- long double y = la - A, y1 = la * r_otk;
- cout << "Интенсивность потока отказов: " << y << " " << y1 << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement