help to improve my code for floorI4

http://www.codechef.com/viewsolution/4856681

I am doing the same as has been said in the tutorial… That is finding those values of [n/i] and decidiing an upper and lower limit for each value and then applying the formula of addition. Please help!

I guess you are not handling the Modulus correctly in your solution. Summation i^4 = n(n - 1)(2n - 1)(3n^2 - 3n - 1) / 30. So to apply modulo to this formula you need to make the terms in the numerator to get divided by the factors of 30 and then apply the modulus.

1 Like

thanx but I think the problem is somewhere in the logic because even after doing what you suggested, I am getting wrong answer…

//