시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
4 초 | 512 MB | 21 | 9 | 7 | 87.500% |
You are given a set $A$ of integers from $1$ to $1000$ inclusive. Your task is to find the number of positive integers that can be represented as a sum of several elements of $A$, with number of summands being from $\ell$ to $r$ inclusive. Equal summands are allowed. Note that each number is counted only once, even if it has several such representations.
The first line of the input contains three space-separated integers: $n$, the number of elements in $A$ ($1 \leq n \leq 1000$), followed by $\ell$ and $r$, the bounds on number of summands ($1 \leq \ell \leq r \leq 2000$). The second line contains $n$ space-separated integers $a_1, a_2, \ldots, a_n$ ($1 \leq a_1 < a_2 < \ldots < a_n \leq 1000$): the elements of the set $A$ in increasing order.
Output the number of integers that are representable as a sum of elements of $A$, with number of summands being between $\ell$ and $r$.
2 1 2 1 2
4
3 1 3 1 3 10
18
6 3 5 1 2 3 4 5 6
28