Advertisement
newb_ie

Untitled

Oct 5th, 2021
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. vector<int> rn,iat,rn_st,st,at,tsb,wt,tse,sst,its;
  4.  
  5. int get_iat (int n) {
  6. if (n >= 875) return 9;
  7. if (n > 750) return 7;
  8. if (n > 625) return 6;
  9. if (n > 500) return 5;
  10. if (n > 375) return 4;
  11. if (n > 250) return 3;
  12. if (n > 125) return 2;
  13. return 1;
  14. }
  15.  
  16. int get_st (int n) {
  17. if (n > 95) return 6;
  18. if (n > 85) return 5;
  19. if (n > 60) return 4;
  20. if (n > 30) return 3;
  21. if (n > 10) return 2;
  22. return 1;
  23. }
  24.  
  25. int main () {
  26. ios::sync_with_stdio(false);
  27. cin.tie(nullptr);
  28. cout.tie(nullptr);
  29. int n = rand() % 15 + 1;
  30. rn.push_back(0);
  31. for (int i = 0; i < n; ++i) {
  32. rn.push_back(rand() % 1000 + 1);
  33. }
  34. iat.push_back(0);
  35. for (int i = 1; i < (int) rn.size(); ++i) {
  36. iat.push_back(get_iat(rn[i]));
  37. }
  38. for (int i = 0; i < n; ++i) {
  39. rn_st.push_back(rand() % 100 + 1);
  40. }
  41. st.push_back(0);
  42. for (int i = 0; i < n; ++i) {
  43. st.push_back(get_st(rn_st[i]));
  44. }
  45. at.push_back(0);
  46. for (int i = 1; i < n; ++i) {
  47. at.push_back(at.back() + iat[i]);
  48. }
  49. tsb.push_back(0);
  50. for (int i = 1; i < n; ++i) {
  51. tsb.push_back(max(tsb.back() + st[i - 1],at[i]));
  52. }
  53. for (int i = 0; i < n; ++i) {
  54. wt.push_back(tsb[i] - at[i]);
  55. }
  56. for (int i = 0; i < n; ++i) {
  57. tse.push_back(tsb[i] + st[i]);
  58. }
  59. for (int i = 0; i < n; ++i) {
  60. sst.push_back(st[i] + wt[i]);
  61. }
  62. its.push_back(0);
  63. for (int i = 1; i < n; ++i) {
  64. its.push_back(abs(tse[i - 1] - tsb[i]));
  65. }
  66. cout << "SN\tRN\tIAT\tAT\tRN_ST\tST\tTSB\tWT\tTSE\tSST\tITS\n";
  67. for (int i = 0; i < n; ++i) {
  68. cout << i << '\t' << rn[i] << '\t' << iat[i] << '\t' << at[i] << '\t' << rn_st[i] << '\t' << st[i] << '\t' << tsb[i] << '\t' << wt[i] << '\t' << tse[i] << '\t' << sst[i] << '\t' << its[i] << '\n';
  69. }
  70. }
  71.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement