#P1414. 又是毕业季II
又是毕业季II
Description
After one rehearsal, the teacher was not very satisfied. Of course, taking each student's ID number to compute a greatest common divisor is clearly unreasonable. So the teacher assigned an ability value to each student. Now the problem becomes: choose students from students so that their synergy (defined as the greatest common divisor of the selected ability values) is maximized. However, there are too many programs, and the required number of people for each program is unknown. The teacher wants to know, for every possible , the maximum achievable synergy. This is getting troublesome, so it is up to you.
Note: The greatest common divisor of a single number is the number itself.
Input Format
The first line contains a positive integer .
The second line contains space-separated positive integers, representing each student's ability value.
Output Format
Output lines. The -th line is the maximum synergy when .
4
1 2 3 4
4
2
1
1
Hint
Source: lzn original.
Constraints
Let the maximum ability value in the input be .
- For of the testdata, , .
- For another of the testdata, , .
- For of the testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号