#include "stdafx.h"
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
long long n, p;
long long tmp;
vector<int> series;
series.reserve(100000);
cin >> n >> p;
for (int i = 0; i < n; ++i)
{
cin >> tmp;
series.push_back(tmp);
}
sort(series.begin(), series.end());
int max_count_series = 0;
auto count = series.size();
for (size_t i = 0; i < count; ++i)
{
for (size_t j = count - 1; j > i; --j)
{
if (series[j] <= series[i] * p)
{
auto max_count_series_tmp = j - i+1;
if (max_count_series_tmp > max_count_series)
{
max_count_series = max_count_series_tmp;
}
}
}
if (max_count_series > (count-i))
break;
}
cout << max_count_series;
return 0;
}
网友评论