Lucian_Adrian

Untitled

Oct 19th, 2021
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int n;
  8. long long S = 0;
  9. cin>>n;
  10. for (int i = 1; i * i <= n; ++i)
  11. if (n % i == 0) {
  12. if (i % 2 == 1)
  13. S += i;
  14. if (i * i != n && ((n / i) % 2 == 1))
  15. S += n / i;
  16. }
  17. cout<<S;
  18. return 0;
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment