fork(2) download
  1. #include <iostream>
  2. #include <map>
  3. using namespace std;
  4. int main ()
  5. {
  6. long long n, sumOfDivisors = 1;
  7. cin >> n;
  8. map<long long, long long> primeDivInPow;
  9. for(long long i = 2; i * i <= n; i++){
  10. while(n % i == 0){
  11. if(primeDivInPow.find(i) == primeDivInPow.end()){
  12. primeDivInPow[i] = 1;
  13. }
  14. primeDivInPow[i] *= i;
  15. n /= i;
  16. }
  17. }
  18. if(n != 1){
  19. primeDivInPow[n] = n;
  20. }
  21. for(map<long long, long long>::iterator p = primeDivInPow.begin(); p != primeDivInPow.end(); p++){
  22. sumOfDivisors *= (p -> second * p -> first - 1) / (p ->first - 1);
  23. }
  24. cout << sumOfDivisors;
  25. return 0;
  26. }
Success #stdin #stdout 0s 4460KB
stdin
Standard input is empty
stdout
118570375203840