当前位置:网站首页>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;
}
边栏推荐
- 基于STM32单片机设计的红外测温仪(带人脸检测)
- “罚点球”小游戏
- Laravel notes - add the function of locking accounts after 5 login failures in user-defined login (improve system security)
- [wechat applet] operation mechanism and update mechanism
- 01 basic introduction - concept nouns
- 15million employees are easy to manage, and the cloud native database gaussdb makes HR office more efficient
- Mécanisme de fonctionnement et de mise à jour de [Widget Wechat]
- Pytest (3) - Test naming rules
- (work record) March 11, 2020 to March 15, 2021
- Simple continuous viewing PTA
猜你喜欢

Gui Gui programming (XIII) - event handling

Use of OLED screen

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
![[DIY]自己设计微软MakeCode街机,官方开源软硬件](/img/a3/999c1d38491870c46f380c824ee8e7.png)
[DIY]自己设计微软MakeCode街机,官方开源软硬件

What key progress has been made in deep learning in 2021?

Web security - payload

B-jiege's tree (pressed tree DP)

Utilisation de l'écran OLED

New database, multidimensional table platform inventory note, flowus, airtable, seatable, Vig table Vika, Feishu multidimensional table, heipayun, Zhixin information, YuQue

性能测试过程和计划
随机推荐
使用.Net驱动Jetson Nano的OLED显示屏
使用.Net分析.Net达人挑战赛参与情况
[weekly pit] calculate the sum of primes within 100 + [answer] output triangle
全网最全的新型数据库、多维表格平台盘点 Notion、FlowUs、Airtable、SeaTable、维格表 Vika、飞书多维表格、黑帕云、织信 Informat、语雀
Maximum likelihood estimation and cross entropy loss
In unity space, an object moves around a fixed point on the sphere at a fixed speed
02 basic introduction - data package expansion
拼多多败诉,砍价始终差0.9%一案宣判;微信内测同一手机号可注册两个账号功能;2022年度菲尔兹奖公布|极客头条
知识图谱构建流程步骤详解
How to upgrade high value-added links in the textile and clothing industry? APS to help
Recyclerview not call any Adapter method :onCreateViewHolder,onBindViewHolder,
Spiral square PTA
Review questions of anatomy and physiology · VIII blood system
Entity alignment two of knowledge map
JMeter server resource indicator monitoring (CPU, memory, etc.)
Dynamically switch data sources
Unity load AB package
C language games - minesweeping
Design your security architecture OKR
Number of schemes from the upper left corner to the lower right corner of the chessboard (2)