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.