sweets
John has got n jars with candies. Each of the jars contains a different kind of candies (i.e. candies from the same jare are of
the same kind, and candies from different jars are of different kinds). The i-th jar contains m[i] candies. John has decided to
eat some of his candies. He would like to eat at least A of them but no more than B. The problem is that John can't decide how
many candies and of what kinds he would like to eat. In how many ways can he do it?<br><br>
Task<br>
Your task is to write a program that:<br>
- reads from the standart input the amount of candies in each of the jars, and integers a and b, <br>
- determines the nubmer of ways John can choose the candies he will eat (satisfying the above conditions),
- writes the result to the standart output<br><br>
Input<br><br>
The first line of input contains three integers: N, A and B, separated by single spaces (1 <= n <= 10, 0 <= A <= B <= 10 000
000). Each of the following n lines contains one integer. Line i+1 contains integer M[i] - the amount of candies in the i-th
jar. (0 <= M[i] <= 1 000 000)<br><br>
Output<br><br>
Let k be the number of different ways John can choose the candies to be eaten. The first and only line of output should contain
one integer: k mod 2004 (i.e. the remainder of k divided by 2004).<br><br>
Example<br><br>
Input<br>
2 1 3<br>
3 5<br><br>
Output<br>
9
<br><br>
John can choose candies in the following ways:<br>
(1,0), (2,0), (3,0), (0,1), (0,2), (0,3), (1,1), (1,2), (2,1)
the same kind, and candies from different jars are of different kinds). The i-th jar contains m[i] candies. John has decided to
eat some of his candies. He would like to eat at least A of them but no more than B. The problem is that John can't decide how
many candies and of what kinds he would like to eat. In how many ways can he do it?<br><br>
Task<br>
Your task is to write a program that:<br>
- reads from the standart input the amount of candies in each of the jars, and integers a and b, <br>
- determines the nubmer of ways John can choose the candies he will eat (satisfying the above conditions),
- writes the result to the standart output<br><br>
Input<br><br>
The first line of input contains three integers: N, A and B, separated by single spaces (1 <= n <= 10, 0 <= A <= B <= 10 000
000). Each of the following n lines contains one integer. Line i+1 contains integer M[i] - the amount of candies in the i-th
jar. (0 <= M[i] <= 1 000 000)<br><br>
Output<br><br>
Let k be the number of different ways John can choose the candies to be eaten. The first and only line of output should contain
one integer: k mod 2004 (i.e. the remainder of k divided by 2004).<br><br>
Example<br><br>
Input<br>
2 1 3<br>
3 5<br><br>
Output<br>
9
<br><br>
John can choose candies in the following ways:<br>
(1,0), (2,0), (3,0), (0,1), (0,2), (0,3), (1,1), (1,2), (2,1)
Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.