Start: Feb, 20, 2019 12:00:00
2018-2019 ACM集训队冬季集训第一次考核
End: Feb, 20, 2019 17:00:00
Time elapsed:
Time remaining:

Problem_ID: H
Result: Accepted
Time: 776ms
Memory: 157968kB
Author: 2017212212148
In contest: 1260

#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<queue>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<map>
#include<stack>
#include<set>
using namespace std;
const int maxn=1e7+10;
long long a[maxn];
long long b[maxn];
int main(){
	long long n,k;
	scanf("%lld %lld",&n,&k);
	for(int i=0;i<n;i++){
		scanf("%lld",&a[i]);
	}
	int maxnum=0;
	int x=0;
	for(int i=0;i<n;i++){
		for(int j=1;j<=k;j++){
			if(a[i]<j)
				break;
			if(a[i]%j==0)
				b[x++]=a[i]/j;
		}
	}
	sort(b,b+x);
	long long s=b[0];
	int max=0;
	for(int i=0;i<x;i++){
		if(b[i]==s)
			max++;
		else{
			s=b[i];
			if(maxnum<max)
				maxnum=max;
			max=1;
		}
	}
	if(maxnum<max)
		maxnum=max;
	printf("%d",maxnum);
}