Ibrahim-Elsayed's blog

By Ibrahim-Elsayed, history, 16 months ago, In English

You are given three integers $$$n$$$, $$$l$$$, and $$$r$$$, count the number of arrays of size $$$n + 1$$$ that have the first element as the average of the whole array and every element of the array is between $$$l$$$ and $$$r$$$ inclusive. print the number of arrays modulo $$$10^9 + 7$$$.

constraints: $$$1 <= n <= 3000$$$, $$$1 <= l <= r <= 10^{18}$$$

samples: Input: $$$5$$$ $$$1$$$ $$$2$$$, Output: $$$20000$$$ Input: $$$4$$$ $$$2$$$ $$$7$$$, Output: $$$322$$$

  • Vote: I like it
  • 0
  • Vote: I do not like it