SPOJ Problem DIVSUM2 - Divisor Summation (Hard)



Problem link


A solution in c++


Post a Comment

6 Comments

  1. Replies
    1. Thanks, It's my mistake for upload file. Now, you can check this code (Ac) :)

      Delete
  2. Logicwise, in the loop inside sod function,the condition must be like:
    i<prime.size() and prime[i]*prime[i]<n(not i*i<n)

    ReplyDelete
    Replies
    1. It's not a major Issue. You can solve this problem in many way :) Your logic is almost correct.

      Delete
  3. what if number is greater than 1e8 how it will work??

    ReplyDelete
    Replies
    1. I think that if the number doesn't have any prime divisor less than 1e8
      then it must be a prime less than or equal 1e16 and it will be handeled in the if(n>1) condition.

      Delete

If you have any doubts, Please let me know