Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. #include<string>
  3. #include<vector>
  4.  
  5. using namespace std;
  6.  
  7. typedef long long int ll;
  8. typedef long double ld;
  9. typedef unsigned long long int ull;
  10. typedef long long li;
  11.  
  12. #define ms(x,a) memset(x,a,sizeof(x))
  13. #define forn(i, n) for (int i = 0; i < int(n); i++)
  14. #define pi      acos(0.0)*2 // 3.1415926535897932
  15. #define mx      100007
  16. #define mod     1000000007
  17. #define base    10000007
  18. #define pb      push_back
  19.  
  20. //ll a[10005];
  21. void inOut();
  22. vector<ll>ans;
  23.  
  24. int main()
  25. {
  26.     //inOut();
  27.     ll i,j,k,l,q,n,m;
  28.     string s;
  29.  
  30.     scanf("%lld%lld", &m, &n);
  31.  
  32.     ll mid = m/2;
  33.  
  34.     for(i=n; i<=mid; i+=n)
  35.         if(m%i==0)
  36.             if(i%n == 0)
  37.                 ans.pb(i);
  38.     if(m%n==0)
  39.         ans.pb(m);
  40.  
  41.     if(ans.size()==0)
  42.         printf("");
  43.     else
  44.     {
  45.         sort(ans.begin(), ans.end());
  46.         for(i=0; i<ans.size(); i++)
  47.             printf("%lld ", ans[i]);
  48.         printf("\n");
  49.     }
  50.  
  51.     return 0;
  52. }
  53.  
  54.  
  55. void inOut()
  56. {
  57.     ios_base::sync_with_stdio(false);
  58.     cin.tie(NULL);
  59.  
  60.     #ifndef ONLINE_JUDGE
  61.         freopen("input.txt", "r", stdin);
  62.         //freopen("output.txt", "w", stdout);
  63.     #endif
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement