lina_os

Untitled

Feb 4th, 2025
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <cmath>
  4. #include <algorithm>
  5. #include <string>
  6. #include <sstream>
  7. #include <set>
  8. #include <map>
  9. #include <unordered_map>
  10. #include <vector>
  11. #include <stack>
  12. #include <deque>
  13.  
  14. using namespace std;
  15.  
  16. int main() {
  17. ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  18. long long n;
  19. cin >> n;
  20. long long ans=1+n;
  21. for (int i=2; i*i<=n; i++) {
  22. if (i*i==n && n%i==0) ans+=i;
  23. else if (n%i==0) ans+=i+n/i;
  24. }
  25. if (n==1) ans--;
  26. cout << ans;
  27.  
  28. return 0;
  29. }
  30.  
  31. /*
  32. *
  33. * */
  34.  
Advertisement
Add Comment
Please, Sign In to add comment