Advertisement
SafronovPG

Untitled

Jan 18th, 2020
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.65 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. using namespace std;
  5. void PrintVector(const vector<bool>& v)
  6. {
  7.     for (int i = 0; i != v.size(); ++i)
  8.     {
  9.         cout << v[i] << endl;
  10.     }
  11. }
  12. void PrintVector2(const vector<string>& v)
  13. {
  14.     for (int i = 0; i != v.size(); ++i)
  15.     {
  16.         cout << v[i] << endl;
  17.     }
  18. }
  19. int Summ(const vector<int>& v)
  20. {
  21.     int fact = 0;
  22.     for (int i = 0; i != v.size(); i++)
  23.     {
  24.         fact = fact + v[i];
  25.     }
  26.     return fact;
  27. }
  28. int main()
  29. {
  30.     int n;
  31.     int d = 0;
  32.     vector <bool> person(0);
  33.     cin >> n;
  34.    
  35.     vector<string> v(n);
  36.     vector<int> k(n);
  37.    
  38.     vector <int> pechat(100);
  39.     vector <int> vivod(100);
  40.     int metka = 0;
  41.     int x=0;
  42.    
  43.     int metka2=0;
  44.     for (int i = 0; i != n; ++i)
  45.     {
  46.         cin >> v[i];
  47.  
  48.         if (v[i] == "COME")
  49.         {
  50.             cin >> d;
  51.             person.resize(person.size()+d,false);
  52.         }
  53.  
  54.         if (v[i] == "WORRY")
  55.         {
  56.             cin >> d;
  57.             person[d] = true;
  58.         }
  59.         if (v[i] == "QUIET")
  60.         {
  61.             cin >> d;
  62.             person[d] = false;
  63.         }
  64.  
  65.  
  66.  
  67.  
  68.         if (v[i] == "WORRY_COUNT")
  69.         {
  70.        
  71.  
  72.             for (int j = 0; j != person.size(); ++j)
  73.             {
  74.  
  75.                 if (person[j] != 0)
  76.                 {
  77.                     pechat[metka] = 1;
  78.                     metka = metka + 1;
  79.  
  80.                 }
  81.             }
  82.  
  83.  
  84.  
  85.             for (int j = 0; j != 99; ++j)
  86.             {
  87.                 if (pechat[j] != 0)
  88.                 {
  89.                     x = x + 1;
  90.                 }
  91.             }
  92.  
  93.  
  94.  
  95.  
  96.  
  97.             for (int j = 0; j != 99; ++j)
  98.             {
  99.                 pechat[j] = 0;
  100.             }
  101.  
  102.  
  103.  
  104.            
  105.             if (x <1) { x = 5;}
  106.             vivod[metka2] = x;
  107.             x = 0;
  108.             metka2 = metka2 + 1;
  109.  
  110.  
  111.  
  112.         }
  113.        
  114.  
  115.  
  116.  
  117.  
  118.  
  119.     }
  120.  
  121.  
  122.  
  123.     for (int j = 0; j != 99; ++j)
  124.     {
  125.         if (vivod[j] != 0)
  126.         {
  127.  
  128.             if (vivod[j] > 2) { vivod[j] =0;}
  129.             cout << vivod[j] << endl;
  130.         }
  131.  
  132.     }
  133.  
  134.  
  135.    
  136.    
  137. //  PrintVector2(v);
  138.     //PrintVector(person);
  139.  
  140.    
  141.  
  142.  
  143. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement