Advertisement
Guest User

Untitled

a guest
Apr 29th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <vector>
  3. #include <map>
  4. #include <set>
  5. #include <complex>
  6. #include <ctime>
  7. #include <iostream>
  8. #include <cmath>
  9. #include <stack>
  10. #include <sstream>
  11. #include <stdio.h>
  12. #include <algorithm>
  13. #include <queue>
  14. #include <cstring>
  15. #include <cassert>
  16. #include <iomanip>
  17. #include <math.h>
  18.  
  19.  
  20. using namespace std;
  21. long double fak(int n)
  22. {
  23. long double f = 1;
  24. for (int i = 1; i <= n; i++)
  25. {
  26. f *= i;
  27. }
  28. return f;
  29. }
  30.  
  31. int main() {
  32. ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  33. srand(unsigned(time(nullptr)));
  34. freopen("input.txt", "r", stdin);
  35. freopen("output.txt", "w", stdout);
  36. long double la = 40;
  37. long double n = 16;
  38. long double t = 1.0/3.0;
  39.  
  40. long double mu = 1.0 / t;
  41. long double ro = la / mu;
  42. long double ro0 = 1;
  43. for (int i = 1; i <= n; i++)
  44. {
  45. ro0 += pow(ro, i) / fak(i);
  46. }
  47. ro0 = 1.0 / ro0;
  48.  
  49. cout << "Интенсивность потока обслуживания: " << mu << endl;
  50. cout << "Коэффициент загрузки канала: " << ro << endl;
  51. for (int i = 0; i <= n; i++)
  52. {
  53. cout << "ro" << i << " = ";
  54. if (i == 0)
  55. {
  56. cout << ro0 << endl;
  57. continue;
  58. }
  59. long double r = ro0 * pow(ro, i) / fak(i);
  60. cout << r << endl;
  61. }
  62. long double r_otk = ro0 * pow(ro, n) / fak(n);
  63. cout << "Вероятность отказа в обслуживании: " << r_otk << endl;
  64. long double Q = 1 - r_otk;
  65. cout << "Относительная пропускная способность СМО: " << Q << endl;
  66. long double A = la * Q;
  67. cout << "Абсолютная пропускная способность СМО: " << A << endl;
  68. long double t_pr = r_otk * t;
  69. cout << "Средняя доля времени простоя СМО: " << t_pr << endl;
  70. long double k_ = A / mu;
  71. cout << "Среднее число занятых каналов: " << k_ << endl;
  72. long double Ts = (1.0 / la) * k_;
  73. cout << "Среднее время пребывания одной заявки в системе (по формуле Литтла): " << Ts << endl;
  74. long double y = la - A, y1 = la * r_otk;
  75. cout << "Интенсивность потока отказов: " << y << " " << y1 << endl;
  76.  
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement