Counting in Base B
You are given arrays $L$ and $R$, each of size $N$, denoting numbers in base $B$ representation. Count the number of arrays of size $N$ such that: - The array denotes a number in base $B$ representation; - The number denoted by the array lies between $L$ and $R$ (both inclusive); - There are exactly $K$ distinct elements in the array. Since the answer may be large, output it modulo $10^9 + 7$.
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start