当前位置:网站首页>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;
}
边栏推荐
- In line elements are transformed into block level elements, and display transformation and implicit transformation
- 7、数据权限注解
- 【OpenCV 例程200篇】220.对图像进行马赛克处理
- 7. Data permission annotation
- Solution to the 38th weekly match of acwing
- PG基础篇--逻辑结构管理(事务)
- New database, multidimensional table platform inventory note, flowus, airtable, seatable, Vig table Vika, Feishu multidimensional table, heipayun, Zhixin information, YuQue
- What key progress has been made in deep learning in 2021?
- Laravel笔记-自定义登录中新增登录5次失败锁账户功能(提高系统安全性)
- 过程化sql在定义变量上与c语言中的变量定义有什么区别
猜你喜欢

OAI 5G NR+USRP B210安装搭建

Comment faire une radio personnalisée

设计你的安全架构OKR

Boder radius has four values, and boder radius exceeds four values

Use of OLED screen

use. Net analysis Net talent challenge participation

Utilisation de l'écran OLED

What programming do children learn?

“罚点球”小游戏

【每周一坑】信息加密 +【解答】正整数分解质因数
随机推荐
Boder radius has four values, and boder radius exceeds four values
[weekly pit] information encryption + [answer] positive integer factorization prime factor
【DSP】【第二篇】了解C6678和创建工程
Database - how to get familiar with hundreds of tables of the project -navicat these unique skills, have you got it? (exclusive experience)
Is it safe to open an account in flush? Which securities company is good at opening an account? Low handling charges
Rhcsa Road
Performance test process and plan
Utilisation de l'écran OLED
Leetcode question 448 Find all missing numbers in the array
Solution to the 38th weekly match of acwing
What key progress has been made in deep learning in 2021?
Activiti global process monitors activitieventlistener to monitor different types of events, which is very convenient without configuring task monitoring in acitivit
JS implementation force deduction 71 question simplified path
Tips for web development: skillfully use ThreadLocal to avoid layer by layer value transmission
Core principles of video games
7. Data permission annotation
硬件开发笔记(十): 硬件开发基本流程,制作一个USB转RS232的模块(九):创建CH340G/MAX232封装库sop-16并关联原理图元器件
Spark SQL chasing Wife Series (initial understanding)
1_ Introduction to go language
Intel 48 core new Xeon run point exposure: unexpected results against AMD zen3 in 3D cache