1085 Perfect Sequence (25 point(s))

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
vector<ll> res;
int main() {
	int n;
	ll p;
	scanf("%ld%lld", &n, &p);
	res.resize(n);
	for(int i = 0; i < n; ++i) scanf("%d", &res[i]);
	sort(res.begin(), res.end());
	int step = 0;
	for(int i = 0; i < n; ++i) {
		for(int j = i + step; j < n; ++j) {
			if(res[i] * p >= res[j]) {
				step = max(step, j - i + 1);
			} else break;
		}
	}
	printf("%lld\n", step);
	return 0;
}

 

相关文章:

  • 2021-10-02
  • 2021-07-13
  • 2021-12-09
  • 2021-06-21
  • 2022-03-01
  • 2022-03-05
  • 2021-04-17
  • 2021-12-24
猜你喜欢
  • 2021-06-14
  • 2022-12-23
  • 2021-09-19
  • 2021-04-10
  • 2021-06-04
  • 2021-07-06
相关资源
相似解决方案