fork download
  1. a=-n=gets.to_i;i=0;n%i>0||a+=n/i+1until 0>n-=i+=1;p a
  2. #----+----1----+----2----+----3----+----4----+----5----+----6
  3. __END__
  4. n=gets.to_i
  5. a=-n
  6. i=0
  7. while ( i+=1; n-=i; n>=0 )
  8. if n%i==0
  9. a+=n/i+1
  10. end
  11. end
  12. p a
Success #stdin #stdout 0.07s 9656KB
stdin
105
stdout
139