QOJ.ac

QOJ

시간 제한: 0.1 s 메모리 제한: 64 MB 총점: 100

#16020. 糖果

통계

John 有 $n$ 个装有糖果的罐子。每个罐子都装有不同种类的糖果(即同一个罐子里的糖果是同一种,不同罐子里的糖果是不同的种类)。第 $i$ 个罐子包含 $m_i$ 颗糖果。John 决定吃掉一些糖果。他想吃掉至少 $a$ 颗且不超过 $b$ 颗糖果。问题是 John 无法决定他想吃多少颗糖果以及每种糖果各吃多少颗。他有多少种不同的吃糖果方案?

你的任务是编写一个程序:

  • 从标准输入读取每个罐子中的糖果数量,以及整数 $a$ 和 $b$;
  • 计算 John 选择要吃掉的糖果的方案数(满足上述条件);
  • 将结果写入标准输出。

输入格式

输入的第一行包含三个整数:$n$、$a$ 和 $b$,由单个空格分隔($1 \le n \le 10$,$0 \le a \le b \le 10\,000\,000$)。

接下来的 $n$ 行,每行包含一个整数。第 $i+1$ 行包含整数 $m_i$ —— 第 $i$ 个罐子中的糖果数量($0 \le m_i \le 1\,000\,000$)。

输出格式

设 $k$ 为 John 选择要吃掉的糖果的不同方案数。输出的第一行且仅有一行应包含一个整数:$k \bmod 2004$(即 $k$ 除以 2004 的余数)。

样例

输入样例 1

2 1 3
3
5

输出样例 1

9

说明

John 可以通过以下方式选择糖果(用 $(x_1, x_2)$ 表示,其中 $x_i$ 表示从第 $i$ 个罐子中选择的糖果数量):

$(1, 0), (2, 0), (3, 0), (0, 1), (0, 2), (0, 3), (1, 1), (1, 2), (2, 1)$

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.