Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- set<long long int>s;
- long long int n,i,x,y,j,z;
- cin>>n;
- for(i=1;i*i<=n;i++){
- if(n%i!=0)
- continue;
- x=n/i;
- j=x;
- y=n-i+2;
- z=0;
- if(x%2!=0)
- z=y/2;
- y=((x/2)*y)+z;
- s.insert(y);
- if(x==i)
- continue;
- x=n/j;
- y=n-j+2;
- z=0;
- if(x%2!=0)
- z=y/2;
- y=((x/2)*y)+z;
- s.insert(y);
- }
- for(auto it=s.begin();it!=s.end();it++)
- cout<<*it<<" ";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement