CyberN00b

Numbers that have N divisors on the line (for big lines)

Oct 23rd, 2020 (edited)
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. #define LINT long long int
  3. using namespace std;
  4. int main() {
  5.     LINT a, b;
  6.     cin >> a >> b;
  7.     vector<vector<LINT>> vc(b + 2);
  8.     for (LINT i = 1; i <= b; ++i)
  9.         for (LINT j = i; j <= b; j += i) {
  10.             vc[j].push_back(i);
  11.         }
  12.     int count;
  13.     cin >> count;
  14.     for (LINT i = a; i <= b; ++i)
  15.         if (vc[i].size() == count) {
  16.             for (auto x : vc[i])
  17.                 cout << x << ' ';
  18.             cout << endl;
  19.         }
  20. }
  21.  
Add Comment
Please, Sign In to add comment