Need More T-shirts!
Time limit1sMemory limit512 MB
Given a list where each entry is either a T-shirt count or a percentage, find every possible total number of T-shirts consistent with the list.
- Level
Hard8 of 10
- Topics
- Number theory, Math, Brute force, Implementation
- Solved
- No attempts yet
Statement
The Innopolis Open 2020 is coming. That means it is time to order T-shirts for the participants of the Olympiad.
The organizers decided it would be good to buy T-shirts in different colors so that anyone can easily tell who is an organizer, who is on the jury, and who is a participant.
Two people were assigned to this task, and they decided how many T-shirts of each color to order. However, they did not agree with each other: one of them wrote down the number of T-shirts of a certain color to order, and the other wrote down the percentage of T-shirts of a certain color. The result is a list of length , where each element is either the number of T-shirts of color or the percentage of T-shirts of color out of the total number of T-shirts. It is also known that at least one element in the list is the number of T-shirts of color .
Now the organizers need to figure out the total number of T-shirts they need to buy for the Olympiad. Help them find all possible values of the total number of T-shirts for which such a list could be obtained.
Input
The first line contains a single integer , the number of different colors ().
The second line contains integers , each being either the number of T-shirts or the percentage of T-shirts of color ().
Output
In the first line print the number of possible values of the total number of T-shirts for which such a list could be obtained.
In the second line print all possible values of the total number of T-shirts in sorted order.
Notes
Explanation of the first example:
If the total number of T-shirts is : one of color and one of color . We obtain the given list if the first element () is the number of T-shirts of color and the second element () is the percentage of T-shirts of color . .
If the total number of T-shirts is : one of color and of color . We obtain the given list if both elements are the numbers of T-shirts of colors and . .
Explanation of the second example: