当前位置:网站首页>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;
}
边栏推荐
猜你喜欢

“罚点球”小游戏

Comment faire une radio personnalisée

1_ Introduction to go language

02 basic introduction - data package expansion

【微信小程序】運行機制和更新機制

Error analysis ~csdn rebound shell error

小孩子学什么编程?

PHP online examination system version 4.0 source code computer + mobile terminal

1500萬員工輕松管理,雲原生數據庫GaussDB讓HR辦公更高效

看过很多教程,却依然写不好一个程序,怎么破?
随机推荐
Review questions of anatomy and physiology · VIII blood system
No Yum source to install SPuG monitoring
JS implementation force deduction 71 question simplified path
小孩子學什麼編程?
全网最全的知识库管理工具综合评测和推荐:FlowUs、Baklib、简道云、ONES Wiki 、PingCode、Seed、MeBox、亿方云、智米云、搜阅云、天翎
Detailed explanation of knowledge map construction process steps
Use of OLED screen
Extraction rules and test objectives of performance test points
Pytest (3) - Test naming rules
全网最全的新型数据库、多维表格平台盘点 Notion、FlowUs、Airtable、SeaTable、维格表 Vika、飞书多维表格、黑帕云、织信 Informat、语雀
Huawei device command
[weekly pit] positive integer factorization prime factor + [solution] calculate the sum of prime numbers within 100
【微信小程序】運行機制和更新機制
电子游戏的核心原理
Variable star --- article module (1)
Catch ball game 1
[diy] self designed Microsoft makecode arcade, official open source software and hardware
OLED屏幕的使用
Tips for web development: skillfully use ThreadLocal to avoid layer by layer value transmission
Entity alignment two of knowledge map