#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#define ll long long
using namespace std;
ll a[100005];
int main()
{
int n,m,i,j;
while(scanf("%d%d",&n,&m)!=EOF)
{
for(i = 0;i<n;i++)scanf("%lld",&a[i]);
sort(a,a+n);
int ans = 0;
i = j = 0;
while(j<n)
{
while(a[j]<=a[i]*m&&j<n)j++;
ans = max(ans,j-i);
if(j>=n)break;
while(a[j]>a[i]*m)i++;
}
printf("%d\n",ans);
}
return 0;
}
pat1085 Perfect Sequence
最新推荐文章于 2023-08-11 20:01:42 发布