Advertisement
erfanul007

CF Good Bye 2018 C

Dec 30th, 2018
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. set<long long int>s;
  7. long long int n,i,x,y,j,z;
  8. cin>>n;
  9. for(i=1;i*i<=n;i++){
  10. if(n%i!=0)
  11. continue;
  12. x=n/i;
  13. j=x;
  14. y=n-i+2;
  15. z=0;
  16. if(x%2!=0)
  17. z=y/2;
  18. y=((x/2)*y)+z;
  19. s.insert(y);
  20. if(x==i)
  21. continue;
  22. x=n/j;
  23. y=n-j+2;
  24. z=0;
  25. if(x%2!=0)
  26. z=y/2;
  27. y=((x/2)*y)+z;
  28. s.insert(y);
  29. }
  30. for(auto it=s.begin();it!=s.end();it++)
  31. cout<<*it<<" ";
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement