-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1085.cpp
More file actions
40 lines (37 loc) · 751 Bytes
/
1085.cpp
File metadata and controls
40 lines (37 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//
// 1085.cpp
// 算法
//
// Created by 王怡凡 on 2017/8/25.
// Copyright © 2017年 王怡凡. All rights reserved.
//
#include <stdio.h>
#include<algorithm>
using namespace std;
const int maxn = 100010;
int n;
long long p,all[maxn];
int main() {
scanf("%d %lld",&n,&p);
int i,max = 1;
for(i=0;i<n;i++) {
scanf("%lld",&all[i]);
}
sort(all,all+n);
int count=1;
for(i=0;i<n-1;i++) {
long long m = all[i];
for(int j=i+max;j<n;j++) {
if(all[j]<=m*p) {
count = j-i+1;
if(count>max) {
max = count;
}
} else {
break;
}
}
}
printf("%d",max);
return 0;
}