当前位置:网站首页>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;
}
边栏推荐
- Value of APS application in food industry
- “罚点球”小游戏
- use. Net analysis Net talent challenge participation
- 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
- 7. Data permission annotation
- Use of OLED screen
- 电子游戏的核心原理
- Taylor series fast Fourier transform (FFT)
- Comment faire une radio personnalisée
- Detailed explanation of knowledge map construction process steps
猜你喜欢
Performance test process and plan
##无yum源安装spug监控
Redis insert data garbled solution
Value of APS application in food industry
【DSP】【第二篇】了解C6678和创建工程
基于STM32单片机设计的红外测温仪(带人脸检测)
Comment faire une radio personnalisée
【每周一坑】输出三角形
PHP online examination system version 4.0 source code computer + mobile terminal
"Penalty kick" games
随机推荐
Web security - payload
Taylor series fast Fourier transform (FFT)
[weekly pit] information encryption + [answer] positive integer factorization prime factor
[DSP] [Part 2] understand c6678 and create project
Unity writes a timer tool to start timing from the whole point. The format is: 00:00:00
Implementation of packaging video into MP4 format and storing it in TF Card
电子游戏的核心原理
Application layer of tcp/ip protocol cluster
Solution to the 38th weekly match of acwing
请问sql group by 语句问题
C language games - minesweeping
##无yum源安装spug监控
SQL injection 2
Design your security architecture OKR
Leetcode hot topic Hot 100 day 32: "minimum coverage substring"
[DIY]如何制作一款个性的收音机
I've seen many tutorials, but I still can't write a program well. How can I break it?
Number of schemes from the upper left corner to the lower right corner of the chessboard (2)
基于STM32单片机设计的红外测温仪(带人脸检测)
使用.Net驱动Jetson Nano的OLED显示屏