当前位置:网站首页>Pat 1085 perfect sequence (25 points) perfect sequence
Pat 1085 perfect sequence (25 points) perfect sequence
2022-07-06 20:50:00 【Python ml】
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n,maxnum=0;
long long p;
cin>>n>>p;
vector<int>a(n);
for(int i=0;i<n;i++){
scanf("%d",&a[i]);
}
sort(a.begin(),a.end());
for(int i=0;i<n;i++){
// Determine the minimum value m
for(int j=i+maxnum;j<n;j++){
if (a[j] <= a[i] * p) {
maxnum=max(j-i+1,maxnum);
}else break;
}
}
cout<<maxnum;
system("pause");
return 0;
}
边栏推荐
- Maximum likelihood estimation and cross entropy loss
- Pycharm remote execution
- Distributed ID
- #yyds干货盘点#重新梳理箭头函数的this
- How to upgrade high value-added links in the textile and clothing industry? APS to help
- Can novices speculate in stocks for 200 yuan? Is the securities account given by qiniu safe?
- "Penalty kick" games
- 知识图谱之实体对齐二
- 2110 summary of knowledge points and common problems in redis class
- C language games - three chess
猜你喜欢
![[weekly pit] calculate the sum of primes within 100 + [answer] output triangle](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[weekly pit] calculate the sum of primes within 100 + [answer] output triangle

Hardware development notes (10): basic process of hardware development, making a USB to RS232 module (9): create ch340g/max232 package library sop-16 and associate principle primitive devices

No Yum source to install SPuG monitoring

Redis insert data garbled solution

use. Net drives the OLED display of Jetson nano

小孩子學什麼編程?
![[diy] how to make a personalized radio](/img/fc/a371322258131d1dc617ce18490baf.jpg)
[diy] how to make a personalized radio

Learn to punch in Web

【DSP】【第一篇】开始DSP学习

【每周一坑】信息加密 +【解答】正整数分解质因数
随机推荐
OAI 5g nr+usrp b210 installation and construction
Simple continuous viewing PTA
B-jiege's tree (pressed tree DP)
Gui Gui programming (XIII) - event handling
Entity alignment two of knowledge map
C language games - minesweeping
什么是RDB和AOF
Leetcode question 283 Move zero
Taylor series fast Fourier transform (FFT)
Boder radius has four values, and boder radius exceeds four values
小孩子学什么编程?
[weekly pit] positive integer factorization prime factor + [solution] calculate the sum of prime numbers within 100
Pytest (3) - Test naming rules
Quel genre de programmation les enfants apprennent - ils?
Comment faire une radio personnalisée
OLED屏幕的使用
Spiral square PTA
[DSP] [Part 2] understand c6678 and create project
[weekly pit] information encryption + [answer] positive integer factorization prime factor
【微信小程序】运行机制和更新机制