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

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

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
  • Проголосовать: не нравится

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

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

»
3 года назад, скрыть # |
 
Проголосовать: нравится 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