fork download
  1. #include <iostream>
  2. #include<cmath>
  3. using namespace std;
  4. void pr(int n)
  5. {
  6. long long sum = 0 ;
  7. for (int i = 1 ; i*i <= n; i++)
  8. {
  9. if (n % i == 0)
  10. {
  11. sum+=i;
  12. if (i*i != n)
  13. {
  14. sum+=n/i;
  15. }
  16.  
  17. }
  18.  
  19. }
  20. cout << sum ;
  21.  
  22. }
  23. int main()
  24. {
  25. cin.tie(0);
  26. cin.sync_with_stdio(0);
  27. long long n;
  28. cin>>n;
  29. pr(n) ;
  30.  
  31. return 0;
  32. }
Success #stdin #stdout 0.01s 5312KB
stdin
Standard input is empty
stdout
875104776