DP Problem doubt


why am i getting Wrong answer??

u have tagged ur doubt with a different question. Pls give the link of the question.

https://codeforces.com/problemset/problem/996/A

i know that it can be solved by another method but i wanna know where i am gng wrong

Since the size of n is upto 10^9 u cannot solve this question using dp. Try to think of greedy solution.

okay so upto what value of n the dp approach is desirable?

In most of the questions at max n can be 10^7 then u can think of dp