salt_n_ice's blog

By salt_n_ice, history, 4 years ago, In English

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.

  • Vote: I like it
  • -1
  • Vote: I do not like it

| Write comment?
»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

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

»
16 months ago, # |
  Vote: I like it 0 Vote: I do not like it

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

  • »
    »
    6 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

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