atcoder#ABC262D. [ABC262D] I Hate Non-integer Number
[ABC262D] I Hate Non-integer Number
Score : points
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.
3
2 6 2
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.
5
5 5 5 5 5
31
Regardless of the choice of one or more terms of , the average equals .