QOJ.ac

QOJ

Límite de tiempo: 3 s Límite de memoria: 512 MB Puntuación total: 100

#8425. 背包问题

Estadísticas

有 $n$ 种重量。第 $i+1$ 种重量的质量不小于两倍第 $i$ 种重量的质量。每种重量你恰好有 2 个。

计算选择若干个重量使得总质量等于 $W$ 的方案数。如果对于某个 $i$,所选第 $i$ 种重量的数量不同,则认为两种方案不同。

输入格式

输入的第一行包含两个整数 $n$ 和 $W$:重量的种类数和目标总质量 ($1 \le n \le 60, 0 \le W \le 4 \cdot 10^{18}$)。

输入的第二行包含 $n$ 个整数 $a_i$:重量的质量。保证 $1 \le a_1, 2 \cdot a_i \le a_{i+1}$ 且 $a_n \le 10^{18}$。

输出格式

输出一行,包含问题的答案。

样例

样例输入 1

5 100
2 5 10 21 49

样例输出 1

3

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.