QOJ.ac

QOJ

時間限制: 4 s 記憶體限制: 512 MB 總分: 100

#1264. الخوارزميات الدنيا

统计

أُعطيت مجموعة $A$ من الأعداد الصحيحة من $1$ إلى $1000$ شمولاً. مهمتك هي إيجاد عدد الأعداد الصحيحة الموجبة التي يمكن تمثيلها كمجموع عدة عناصر من $A$، بحيث يكون عدد الحدود من $\ell$ إلى $r$ شمولاً. يُسمح بتساوي الحدود. لاحظ أن كل عدد يُحسب مرة واحدة فقط، حتى إن كانت له عدة تمثيلات من هذا النوع.

الإدخال

يحتوي السطر الأول من الإدخال على ثلاثة أعداد صحيحة تفصل بينها مسافات: $n$، وهو عدد عناصر $A$ ($1 \le n \le 1000$)، يليه $\ell$ و$r$، وهما حدا عدد الحدود ($1 \le \ell \le r \le 2000$). يحتوي السطر الثاني على $n$ عددًا صحيحًا تفصل بينها مسافات، $a_1,a_2,\ldots,a_n$ ($1 \le a_1 < a_2 < \ldots < a_n \le 1000$)، وهي عناصر المجموعة $A$ بترتيب تصاعدي.

الإخراج

اطبع عدد الأعداد الصحيحة التي يمكن تمثيلها كمجموع عناصر من $A$، بحيث يكون عدد الحدود بين $\ell$ و$r$.

أمثلة

الإدخال 1

2 1 2
1 2

الإخراج 1

4

الإدخال 2

3 1 3
1 3 10

الإخراج 2

18

الإدخال 3

6 3 5
1 2 3 4 5 6

الإخراج 3

28

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.