#abc262d. D - I Hate Non-integer Number
D - I Hate Non-integer Number
Score : points
问题描述
给定一个包含 个正整数的序列 。
从 中选择一个或多个项有 种方式。其中有多少种方式可以使得所选项的平均值为整数?请计算该数量对 取模的结果。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given a sequence of positive integers of length .
There are ways to choose one or more terms of . How many of them have an integer-valued average? Find the count modulo .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
3
2 6 2
Sample Output 1
6
For each way to choose terms of , the average is obtained as follows:
-
If just is chosen, the average is , which is an integer.
-
If just is chosen, the average is , which is an integer.
-
If just is chosen, the average is , which is an integer.
-
If and are chosen, the average is , which is an integer.
-
If and are chosen, the average is , which is an integer.
-
If and are chosen, the average is , which is an integer.
-
If , , and are chosen, the average is $\frac{a_1+a_2+a_3}{3}=\frac{2+6+2}{3} = \frac{10}{3}$, which is not an integer.
Therefore, ways satisfy the condition.
Sample Input 2
5
5 5 5 5 5
Sample Output 2
31
Regardless of the choice of one or more terms of , the average equals .
update @ 2024/3/10 11:06:03