Advertisement
O_Egor

60

May 26th, 2022 (edited)
477
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <vector>
  3. #include <cmath>
  4. #include <map>
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     vector <pair<int, int>> ans;
  10.     int start(700000);
  11.     while (ans.size() < 5)
  12.     {
  13.         int counter(0);
  14.         for (int i = 2; i < start / 2 + 1; ++i)
  15.             if (start % i == 0)
  16.                 counter++;
  17.         if (ans.size())
  18.         {
  19.             if (counter > ans[ans.size() - 1].second)
  20.                 ans.push_back({ start,counter });
  21.             else
  22.                 ans.clear();
  23.         }
  24.         else
  25.         {
  26.             ans.push_back({ start,counter });
  27.         }
  28.         start++;
  29.     }
  30.     for (int i = 0; i < 5; ++i)
  31.     {
  32.         cout << ans[i].first << ' ' << ans[i].second << '\n';
  33.     }
  34.     return 0;
  35. }
Advertisement
RAW Paste Data Copied
Advertisement