Advertisement
maxim_shlyahtin

F

Nov 27th, 2021
960
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <vector>
  4. #include <limits>
  5. using namespace std;
  6.  
  7.  
  8. int main()
  9. {
  10.     vector<int> a;
  11.     vector<int> b;
  12.     int count = 0, j, max = 0;
  13.     cin >> j;
  14.     for (int k = 1; k <= j; k++) {
  15.         for (int i = 1; i <= k; i++)
  16.         {
  17.             if (k % i == 0)
  18.                 count++;
  19.         }
  20.         a.push_back(k);
  21.         b.push_back(count);
  22.         count = 0;
  23.     }
  24.     for (int i = 0; i < b.size(); i++) {
  25.         if (b[i] == *max_element(b.begin(), b.end())) {
  26.             max = i;
  27.             break;
  28.         }
  29.     }
  30.     cout << a[max] << endl;
  31.     for (int i = 1; i <= 20; i++)
  32.     {
  33.         if (20 % i == 0)
  34.             cout << i << endl;
  35.     }
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement