当前位置:网站首页>Biscuit distribution
Biscuit distribution
2022-06-25 14:34:00 【I'm not xiaohaiwa~~~~】
1. Distribution problem
There's a bunch of kids and a bunch of biscuits , Every child has a hunger level ,° Each cookie has a size .
Each child can only eat at most one biscuit , And only when the size of the biscuit is greater than the child's hunger , The child will be able to eat .
How many children can eat at most .
I/o sample
Input :
1 2
1 2 3
Output :2
Code:
int solve(vector<int> &children,vector<int> &cookies)
{
sort(children.begin(),children.end());
sort(cookies.begin(),cookies.end());
int ichi=0;
int icook=0;
while(ichi<children.size()&&icook<cookies.size())
{
if(children[ichi]<cookies[icook++])ichi++;
}
return ichi;
}
边栏推荐
- Heavyweight! The domestic IDE is released and developed by Alibaba. It is completely open source! (high performance + high customization)
- shell 变量 入门
- Kubernetes cluster construction of multiple ECS
- Solving error: creating window glfw error: glew initialization error: missing GL version
- Nine parts of speech and nine tenses in English
- Clipboard tutorial
- oracle数据库常用的函数总结
- Pourquoi les programmeurs devraient - ils être plus doux?
- JGG | 河北大学杜会龙组综述植物泛基因组学研究
- 分享自己平時使用的socket多客戶端通信的代碼技術點和軟件使用
猜你喜欢
JGG | overview of duhuilong group of Hebei University Research on plant pan genomics
Page 112 machine learning - review of fundamentals of mathematics pptx
分享自己平時使用的socket多客戶端通信的代碼技術點和軟件使用
What are the red lines of open source that should not be trodden on?
‘nvidia-smi‘ 不是内部或外部命令,也不是可运行的程序或批处理文件
oracle数据库常用的函数总结
中国电池技术取得重大突破,日韩美都落后了,中国巩固了领先优势
Windows下MySQL的安装和删除
It's not easy to understand the data consistency of the microservice architecture for the first time after six years as a programmer
Nine parts of speech and nine tenses in English
随机推荐
Extend JS copy content to clipboard
shell 字符串变量
Summary of common functions in Oracle Database
Report on Hezhou air32f103cbt6 development board
Custom instruction, mixing, routing, lifecycle
广发易淘金和同花顺哪个更好,更安全一些
Supplementary inheritance and strict mode
成员变量与局部变量的区别
【HBZ分享】LockSupport的使用
What are the red lines of open source that should not be trodden on?
使用sphinx根据py源文件自动生成API文档
分饼干问题
Basic usage of markdown (plain text and grammar)
Garbage collection mechanism
JS determines whether two values are equal, and compares any two values, including array objects
现在股票开户用什么app最安全?知道的给说一下吧
重磅!国产 IDE 发布,由阿里研发,完全开源!(高性能+高定制性)
One time summary: 64 common terms for data analysis!
Nine parts of speech and nine tenses in English
sigmoid函数sigmoid求导