Advertisement
erfanul007

CF Good Bye 2018 C (tle)

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