第 044 场 AtCoder Beginner Contest
Tak 与卡片AI (CI翻译)
Problem Statement
题目描述
AI (CI翻译)Tak has $N$ cards. On the $i$-th $(1 \leq i \leq N)$ card is written an integer $x_i$. He is selecting one or more cards from these $N$ cards, so that the average of the integers written on the selected cards is exactly $A$. In how many ways can he make his selection?
Tak 有 $N$ 张卡片。第 $i$ 张 $(1 \leq i \leq N)$ 卡片上写着一个整数 $x_i$。他要从这 $N$ 张卡片中选择一张或多张,使所选卡片上整数的平均值恰好为 $A$。他有多少种选择方式?AI (CI翻译)
Constraints
约束条件
AI (CI翻译)$1 \leq N \leq 50$$1 \leq A \leq 50$$1 \leq x_i \leq 50$$N,\,A,\,x_i$are integers.
$1 \leq N \leq 50$$1 \leq A \leq 50$$1 \leq x_i \leq 50$$N,\,A,\,x_i$均为整数。
Partial Score
部分分
AI (CI翻译)$200$points will be awarded for passing the test set satisfying$1 \leq N \leq 16$.
- 通过满足
$1 \leq N \leq 16$的测试集,可获得$200$分。
Input
输入格式
AI (CI翻译)The input is given from Standard Input in the following format:
输入通过标准输入给出,格式如下:AI (CI翻译)
N A
x_1 x_2 ... x_N
N A
x_1 x_2 ... x_NAI (CI翻译)
Output
输出格式
AI (CI翻译)Print the number of ways to select cards such that the average of the written integers is exactly $A$.
输出选择卡片的方式数,使所选卡片上整数的平均值恰好为 $A$。AI (CI翻译)
样例
Input #1
4 8
7 9 8 9
Output #1
5
- The following are the $5$ ways to select cards such that the average is $8$:
- Select the $3$-rd card.
- Select the $1$-st and $2$-nd cards.
- Select the $1$-st and $4$-th cards.
- Select the $1$-st, $2$-nd and $3$-rd cards.
- Select the $1$-st, $3$-rd and $4$-th cards.
Input #2
3 8
6 6 9
Output #2
0
Input #3
8 5
3 6 2 8 7 6 5 9
Output #3
19
Input #4
33 3
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
Output #4
8589934591
- The answer may not fit into a $32$-bit integer.
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。