patB1030/patA1085 完美数列

#include <iostream>

#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn=100001;
int num[maxn];
int main(int argc, char** argv) {
int n,p;
scanf("%d%d",&n,&p);
for(int i=0;i<n;i++) scanf("%d",&num[i]);
sort(num,num+n);
int ans=0;
for(int i=0;i<n;i++){
int mint=num[i]*p;
int tempans=0;
for(int j=i;j<n;j++){
if(num[j]<=mint) tempans++;
}
if(tempans>ans) ans=tempans;
}
printf("%d",ans);
return 0;
}

相关文章:

  • 2021-11-28
  • 2021-11-24
  • 2022-12-23
  • 2022-02-15
  • 2021-09-28
  • 2021-12-11
  • 2021-06-25
  • 2021-10-15
猜你喜欢
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案