You are viewing a single comment's thread. Return to all comments →
can you explain how did you get that formula? I have used this formula but still getting timeout on every testcase except the sample testcase.
You get the formula (or a similar one) if you type into Wolfram Alpha: sum((a+kd)^2,k=0..n)