Codeforces и Polygon могут быть недоступны в период с 6 декабря, 22:00 (МСК) по 7 декабря, 00:00 (МСК) в связи с проведением технических работ. ×

Блог пользователя Hepic_Antony_Skarlatos

Автор Hepic_Antony_Skarlatos, 10 лет назад, По-английски

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??

  • Проголосовать: нравится
  • -8
  • Проголосовать: не нравится

»
10 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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