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: 1528ms
Memory: 39224kB
Author: 2018212212064
In contest: 1260

#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <iostream>
using namespace std;
const int maxn=1e5+10;
long long stick[maxn];
map<long long,int> mp;
int main()
{
	long long n,k;
	scanf("%lld%lld",&n,&k);
	for(int i=0;i<n;++i)
		scanf("%lld",stick+i);
	for(int i=0;i<n;++i)
	{
		int p=min(k,(long long)sqrt(stick[i]));
		for(int j=1;j<=p;++j)
			if(stick[i]%j==0)
			{
				if(stick[i]/j<=k)mp[j]++;
				if(j<=k)mp[stick[i]/j]++;
				if(j*j==stick[i])mp[j]--;
			}
	}
	map<long long,int>::iterator it=mp.begin();
	int maxs=0;
	for(;it!=mp.end();++it)
	{
		if(it->second>maxs)maxs=it->second;
	}
	printf("%d\n",maxs);
}