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: 2825ms
Memory: 66664kB
Author: 2017212212003
In contest: 1260

#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int inf = 0x3f3f3f3f;
const int maxn = 1e5 + 10;
const ll mod = 1e9 + 7;

int n;
ll k;
ll len[maxn];
map<ll, int>mp;
set<ll>s;

int main()
{
	scanf("%d %lld", &n, &k);
	for(int i = 1; i <= n; i++)
	{
		scanf("%lld", &len[i]);
		for(ll j = 1; j <= k; j++)
		{
			if(len[i] % j == 0)
			{
				mp[len[i] / j]++;
				s.insert(len[i] / j);
			}
		}
	}
	int ans = 1;
	for(set<ll>::iterator it = s.begin(); it != s.end(); it++)
	{
		ans = max(ans, mp[*it]);
	}
	cout << ans << endl;
}