A10679. Bash's Big Day
编程题
普及/提高-
知识点
题目描述
Bash has set out on a journey to become the greatest Pokemon master. To get his first Pokemon, he went to Professor Zulu's Lab. Since Bash is Professor Zulu's favourite student, Zulu allows him to take as many Pokemon from his lab as he pleases.
But Zulu warns him that a group of $k>1$ Pokemon with strengths ${s_{1},s_{2},s_{3},...,s_{k}}$ tend to fight among each other if $gcd(s_{1},s_{2},s_{3},...,s_{k})=1$ (see notes for $gcd$ definition).
Bash, being smart, does not want his Pokemon to fight among each other. However, he also wants to maximize the number of Pokemon he takes from the lab. Can you help Bash find out the maximum number of Pokemon he can take?
Note: A Pokemon cannot fight with itself.
But Zulu warns him that a group of $k>1$ Pokemon with strengths ${s_{1},s_{2},s_{3},...,s_{k}}$ tend to fight among each other if $gcd(s_{1},s_{2},s_{3},...,s_{k})=1$ (see notes for $gcd$ definition).
Bash, being smart, does not want his Pokemon to fight among each other. However, he also wants to maximize the number of Pokemon he takes from the lab. Can you help Bash find out the maximum number of Pokemon he can take?
Note: A Pokemon cannot fight with itself.
输入格式
The input consists of two lines.
The first line contains an integer $n$ ( $1<=n<=10^{5}$ ), the number of Pokemon in the lab.
The next line contains $n$ space separated integers, where the $i$ -th of them denotes $s_{i}$ ( $1<=s_{i}<=10^{5}$ ), the strength of the $i$ -th Pokemon.
The first line contains an integer $n$ ( $1<=n<=10^{5}$ ), the number of Pokemon in the lab.
The next line contains $n$ space separated integers, where the $i$ -th of them denotes $s_{i}$ ( $1<=s_{i}<=10^{5}$ ), the strength of the $i$ -th Pokemon.
输出格式
Print single integer — the maximum number of Pokemons Bash can take.
输入输出样例
输入 #1
3 2 3 4
输出 #1
2
输入 #2
5 2 3 4 6 7
输出 #2
3
说明/提示
$gcd$ (greatest common divisor) of positive integers set ${a_{1},a_{2},...,a_{n}}$ is the maximum positive integer that divides all the integers ${a_{1},a_{2},...,a_{n}}$ .
In the first sample, we can take Pokemons with strengths ${2,4}$ since $gcd(2,4)=2$ .
In the second sample, we can take Pokemons with strengths ${2,4,6}$ , and there is no larger group with $gcd≠1$ .
In the first sample, we can take Pokemons with strengths ${2,4}$ since $gcd(2,4)=2$ .
In the second sample, we can take Pokemons with strengths ${2,4,6}$ , and there is no larger group with $gcd≠1$ .