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

Автор Gagandeep98, история, 4 года назад, По-английски

Can anyone please provide any hint for this problem? Throwing Dice

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

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

Let f(n) be the number of ways of throwing dices to get a sum of n, Then consider the last dice throw. It has 6 possibilities 1-6. So f(n) = f(n-1) + f(n-2) + ... + f(n-6).

»
4 года назад, # |
Rev. 4   Проголосовать: нравится +11 Проголосовать: не нравится

My fav trick in such problems:
1. precalc first 20 values
2. use Berlekamp-Massey algorihm to compute n_th value of Linear recurrence
source: https://codeforces.com/blog/entry/61306?
another problems:
https://codeforces.com/contest/392/submission/51596991
https://codeforces.com/contest/678/submission/51597127