Can anyone suggest how can I approach this problem:-
https://www.codechef.com/FFC22019/problems/FFC219A
I have looked at few submissions, most of them are using the similar type of approach, but I'm not able to understand the concept behind it. Any help is appreciated.
It was a copied question from codeforces. Just take a look at this:-
https://codeforces.net/contest/622/problem/F .
Look at it's editorial if you want the slution approach.
Thanks
have you understood, I still haven't understood, can you please explain it in easy way if possible
I also got only the part when n < k+2, and trying to understand the part for n > k+1.
I tried lagrange interpolation (see geeksforgeeks or CP algorithm), as a similar problem appeared some months back in a long challenge(June challenge, 2019 i believe, div.1 6th problem), but to no avail as I couldn't get rid of TLE due to such tight constraints.... :(
https://www.hackerrank.com/contests/infinitum-mar14/challenges/summing-the-k-n-series/editorial