Advertisement
dimon-torchila

Untitled

Dec 29th, 2021
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include<iostream>
  2. #include<map>
  3. #include<vector>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     map <int, int> coordinate;
  10.     vector<double> ss;
  11.     coordinate[2] = 4;
  12.     coordinate[2] = 8;
  13.     coordinate[6] = 3;
  14.     coordinate[6] = 9;
  15.     coordinate[5] = 11;
  16.     coordinate[5] = 1;
  17.     for (const auto& c : coordinate)
  18.     {
  19.         int y = 0,sum = 0,k = 0;
  20.         if (c.first != y)
  21.         {
  22.             y = c.first;
  23.             ss.push_back(double(sum) / k);
  24.             k = 0;
  25.             sum = 0;
  26.         }
  27.         else
  28.         {
  29.             k++;
  30.             sum += c.second;
  31.             cout << sum << k;
  32.         }
  33.     }
  34.     map<double, int> counters;
  35.     for (const auto& c : ss)
  36.         ++counters[c];
  37.     if (counters.size() == 1)
  38.         cout << "YES";
  39.     else
  40.         cout << "NO";
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement