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: 1682ms
Memory: 38736kB
Author: 2017212212172
In contest: 1260

#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
using namespace std;
#define inf 0x3f3f3f3f
typedef long long LL;
const LL mod = 1e9 + 7;
long long  ax[100010];
map<long long,int>mp;
int main(void) {
	LL n, k;
	scanf("%lld%lld", &n, &k);
	for (int i = 0; i < n; i++) {
		scanf("%lld", &ax[i]);
	}
	mp.clear();
	long long x = -1;
	long long maxx = -1;
	for (int i = 1; i <= k; i++) {
		for (int z = 0; z < n; z++) {
			if (ax[z] % i == 0) {
				long long num = ax[z] / i;
				mp[num]++;
				if (mp[num] > maxx) {
					x = num;
					maxx = mp[num];
				}
			}
		}
	}
	long long sum = 0;
	for (int i = 0; i < n; i++) {
		if (ax[i] % x == 0&&ax[i]/x<=k) {
			sum += 1;
		}
	}
	printf("%lld\n", sum);
	return 0;
}