problem link: http://lightoj.com/volume_showproblem.php?problem=1098
PDF Link: lightoj.com/volume_showproblem.php?problem=1098&language=english&type=pdf
I think this problems solution is Summation of ((floor(N/i) — 1) * i) .But n is 10^9. It will definately get TLE if I precalculate or use loop.I think there exist something that I do not know yet.Please help me solve this problem. If I need to learn any theory/algorithm to solve this problem please mention it.
Thank you very much.
There's one remark about floor (N/i) is that for i = 1 to N there will only be O(sqrt(N)) value of floor(N/i) so you can loop through all the value of floor(N/i) then calculate the range of the value then sum them together.
I understood what you have said.
Why is he getting downvotes ? I do not understand :/