A. Hit the Lottery

Can anyone do this by dp as it shows dp tag

Have you figured out a solution that doesn’t involve DP?

EDIT: Never mind, I looked at the problem and there is a pretty simple greedy solution.

Yes constraints are large so we have to do by greedy