#include <bits/stdc++.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
const int maxn = 100010;
int main(int argc, char** argv) {
int n, arr[maxn];
long long int p;
cin >> n >> p;
for(int i = 0; i < n; i++){
cin >> arr[i];
}
sort(arr, arr+n);
int i = 0, j = 0, ans = 1;
while(i < n && j < n){
//j不断右移,直到恰好不满足条件
while(j < n && arr[j] <= (long long) (arr[i] * p)){
ans = max(ans, j - i + 1);
j++;
}
i++;
}
cout << ans;
return 0;
}
A1085 Perfect Sequence (25 分)
猜你喜欢
转载自blog.csdn.net/alovelypeach/article/details/114404252
今日推荐
周排行