当前位置:网站首页>【ACM】455. 分发饼干(1. 大饼干优先喂给大胃口;2. 遍历两个数组可以只用一个for循环(用下标索引--来遍历另一个数组))
【ACM】455. 分发饼干(1. 大饼干优先喂给大胃口;2. 遍历两个数组可以只用一个for循环(用下标索引--来遍历另一个数组))
2022-04-23 18:06:00 【CashAp】
455. 分发饼干
1 贪心
- 如何处理同一块饼干喂给多个小孩的问题?
(使用数组下标,饼干使用过之后,饼干数组的下标就--
,即后面使用数组中的前一块饼干) - 饼干少于孩子个数,如何处理饼干数组指针越界问题?
使用饼干数组有元素时(index >= 0
),才把饼干给小孩
if (index >= 0 && s[index
版权声明
本文为[CashAp]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_60225495/article/details/124363083
边栏推荐
- Implementation of k8s redis one master multi slave dynamic capacity expansion
- Array rotation
- What are the relationships and differences between threads and processes
- ROS package NMEA_ navsat_ Driver reads GPS and Beidou Positioning Information Notes
- Vulnérabilité d'exécution de la commande de fond du panneau de commande JD - freefuck
- Classes and objects
- 线上怎么确定期货账户安全的?
- Reptile efficiency improvement method
- Rewrite four functions such as StrCmp in C language
- Serialization scheme of serde - trust
猜你喜欢
Calculation of fishing net road density
MySQL_01_简单数据检索
Visualization of residential house prices
Yolov4 pruning [with code]
Go的Gin框架学习
positioner
Implementation of object detection case based on SSD
[UDS unified diagnostic service] IV. typical diagnostic service (6) - input / output control unit (0x2F)
Transfer learning of five categories of pictures based on VGg
re正則錶達式
随机推荐
powerdesigner各种字体设置;preview字体设置;sql字体设置
Selenium + phantom JS crack sliding verification 2
C medium? This form of
.104History
proxy server
2022江西储能技术展会,中国电池展,动力电池展,燃料电池展
C language input and output (printf and scanf functions, putchar and getchar functions)
cartographer_ There is no problem compiling node, but running the bug that hangs directly
GDAL + ogr learning
Implementation of k8s redis one master multi slave dynamic capacity expansion
[UDS unified diagnostic service] v. diagnostic application example: Flash bootloader
ArcGIS table to excel exceeds the upper limit, conversion failed
Serialization scheme of serde - trust
Classification of cifar100 data set based on convolutional neural network
Generate verification code
I / O multiplexing and its related details
Robocode tutorial 3 - Robo machine analysis
[UDS unified diagnostic service] (Supplement) v. detailed explanation of ECU bootloader development points (2)
Box pointer of rust
A few lines of code teach you to crawl lol skin pictures