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

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

Link I found the number of possible ways of having sum between a and b using dp. The problem is that this number can exceed the long long limits and hence for larger values, my solution is not working.

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

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

Which problem is it? Is it this one? https://cses.fi/problemset/task/1633

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

    No, It's "Dice Probability", Your link opens "Dice Combinations", I have included the link

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

As the numbers are of the order of 6^n you can't store it in any inbuilt integer. So instead of this, we can just store the probability instead of the number of ways that sum can occur. And here's my implementation of the same. code

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

    Thanks, this solved my issue with c++. Alternatively, we can also use Python.