Hepic_Antony_Skarlatos's blog

By Hepic_Antony_Skarlatos, 10 years ago, In English

I have a question about the problem above in the title. If instead dp,I use bruteforcing??? For example in the first input "3 3 2", with bruteforce I would have these: 1 1, 1 2, 1 3, ... ... 1 1 1, 1 1 2, 1 1 3, 1 2 1, 1 2 2, 1 2 3, .....

For each one,I would check the sum and if it has at least d. Program would run more than 1 second??

»
10 years ago, # |
  Vote: I like it 0 Vote: I do not like it

1)When you check, you add one sequence to answer, but you see that in problem your answer would be by modulo 10^9+7, so easy to think that there are many such sequences, and it would run much more than 1 second

2) The number of sequences which consist M edjes is about C(n-1, m) when k = n, for example C(99, 50) more than 10^18