当前位置:网站首页>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;
}
边栏推荐
- Error analysis ~csdn rebound shell error
- 正则表达式收集
- Detailed introduction of distributed pressure measurement system VIII: basic introduction of akka actor model
- What is the difference between procedural SQL and C language in defining variables
- 使用.Net分析.Net达人挑战赛参与情况
- Rhcsa Road
- 【每周一坑】正整数分解质因数 +【解答】计算100以内质数之和
- use. Net drives the OLED display of Jetson nano
- 硬件开发笔记(十): 硬件开发基本流程,制作一个USB转RS232的模块(九):创建CH340G/MAX232封装库sop-16并关联原理图元器件
- Utilisation de l'écran OLED
猜你喜欢
2022 refrigeration and air conditioning equipment installation and repair examination contents and new version of refrigeration and air conditioning equipment installation and repair examination quest
新型数据库、多维表格平台盘点 Notion、FlowUs、Airtable、SeaTable、维格表 Vika、飞书多维表格、黑帕云、织信 Informat、语雀
Design your security architecture OKR
C language operators
15million employees are easy to manage, and the cloud native database gaussdb makes HR office more efficient
[asp.net core] set the format of Web API response data -- formatfilter feature
【微信小程序】運行機制和更新機制
[200 opencv routines] 220 Mosaic the image
Implementation of packaging video into MP4 format and storing it in TF Card
[weekly pit] information encryption + [answer] positive integer factorization prime factor
随机推荐
Spark SQL chasing Wife Series (initial understanding)
recyclerview gridlayout 平分中间空白区域
[diy] how to make a personalized radio
【DSP】【第一篇】开始DSP学习
[weekly pit] calculate the sum of primes within 100 + [answer] output triangle
Pinduoduo lost the lawsuit, and the case of bargain price difference of 0.9% was sentenced; Wechat internal test, the same mobile phone number can register two account functions; 2022 fields Awards an
Error analysis ~csdn rebound shell error
2022 construction electrician (special type of construction work) free test questions and construction electrician (special type of construction work) certificate examination
[DSP] [Part 1] start DSP learning
User defined current limiting annotation
Basic knowledge of lists
设计你的安全架构OKR
[DSP] [Part 2] understand c6678 and create project
小孩子學什麼編程?
Common doubts about the introduction of APS by enterprises
Trends of "software" in robotics Engineering
Comment faire une radio personnalisée
Performance test process and plan
Simple continuous viewing PTA
【每周一坑】计算100以内质数之和 +【解答】输出三角形