当前位置:网站首页>[brush title] goose factory shirt problem
[brush title] goose factory shirt problem
2022-07-05 16:31:00 【m0_ sixty million six hundred and thirty-one thousand three hun】
One 、 subject
Penguin factory activity hair shirt , There are many kinds of t-shirts , Penguins wear T-shirts . In an interview with , Penguins will say how many more penguins wear a T-shirt with him . Some penguins were not interviewed , Put these answers in answers In the array , Return the minimum number of penguins in the activity 
Two 、 Answer key
2.1 Ideas



2.2 Source code
Source code :
public static int minPeople(int[] arr){
int x=arr[0];
int c=1;
int ans=0;
for (int i = 0; i < arr.length; i++) {
if(x!=arr[i]){
ans+=((c+x)/(x+1))*(x+1);
x=arr[i];
c=1;
}else {
c++;
}
}
return ans+((c+x)/(x+1))*(x+1);
}
边栏推荐
- 详解SQL中Groupings Sets 语句的功能和底层实现逻辑
- OneForAll安装使用
- PSPNet | 语义分割及场景分析
- Parameter type setting error during batch update in project SQL
- 漫画:什么是分布式事务?
- DeSci:去中心化科学是Web3.0的新趋势?
- 一些認知的思考
- Today's sleep quality record 79 points
- How does win11 change icons for applications? Win11 method of changing icons for applications
- Practice independent and controllable 3.0 and truly create the open source business of the Chinese people
猜你喜欢

Cs231n notes (top) - applicable to 0 Foundation
英特尔第13代Raptor Lake处理器信息曝光:更多核心 更大缓存

Win11如何给应用换图标?Win11给应用换图标的方法

Android 隐私沙盒开发者预览版 3: 隐私安全和个性化体验全都要

Reduce the cost by 40%! Container practice of redis multi tenant cluster

Desci: is decentralized science the new trend of Web3.0?

Pits encountered in the use of boolean type in development

Research and development efficiency measurement index composition and efficiency measurement methodology
Intel 13th generation Raptor Lake processor information exposure: more cores, larger cache

服务器的数据库连不上了2003,10060“Unknown error“【服务已起、防火墙已关、端口已开、netlent 端口不通】
随机推荐
养不起真猫,就用代码吸猫 -Unity 粒子实现画猫咪
解决CMakeList find_package找不到Qt5,找不到ECM
Android 隐私沙盒开发者预览版 3: 隐私安全和个性化体验全都要
[echart] resize lodash 实现窗口缩放时图表自适应
list去重并统计个数
Benji Bananas 会员通行证持有人第二季奖励活动更新一览
Domestic API management artifact used by the company
极坐标扇图使用场景与功能详解
One click installation script enables rapid deployment of graylog server 4.2.10 stand-alone version
List de duplication and count the number
为季前卡牌游戏 MotoGP Ignition Champions 做好准备!
超分辨率技术在实时音视频领域的研究与实践
Summary of methods for finding intersection of ordered linked list sets
Some cognitive thinking
Pspnet | semantic segmentation and scene analysis
企业级备份软件Veritas NetBackup(NBU) 8.1.1服务端的安装部署
Oneforall installation and use
二叉树相关OJ题
Cartoon: what is the eight queens problem?
新春限定丨“牛年忘烦”礼包等你来领~