#define LOCAL
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
using namespace std;
const int maxn=100010;
int a[maxn];
int main()
{
#ifdef LOCAL
freopen("data.in","r",stdin);
freopen("data.out","w",stdout);
#endif // LOCAL
int n,p;
cin>>n>>p;
for(int i=0;i<n;i++){
cin>>a[i];
}
sort(a,a+n);
int ans=1;
for(int i=0;i<n;i++){
int j=upper_bound(a+i+1,a+n,(long long)a[i]*p)-a;
ans=max(ans,j-i);
}
cout<<ans;
return 0;
}
【PAT】1085. Perfect Sequence
最新推荐文章于 2022-02-14 10:08:49 发布