当前位置:网站首页>[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);
}
边栏推荐
- ES6 deep - ES6 class class
- Data Lake (XIV): spark and iceberg integrated query operation
- Solve the Hanoi Tower problem [modified version]
- 数据访问 - EntityFramework集成
- 国泰君安网上开户安全吗
- The difference between abstract classes and interfaces
- vulnhub-FirstBlood
- 英特尔第13代Raptor Lake处理器信息曝光:更多核心 更大缓存
- 一键安装脚本实现快速部署GrayLog Server 4.2.10单机版
- 超分辨率技术在实时音视频领域的研究与实践
猜你喜欢
随机推荐
漫画:什么是服务熔断?
Apiccloud cloud debugging solution
漫画:什么是MapReduce?
【网易云信】超分辨率技术在实时音视频领域的研究与实践
One click installation script enables rapid deployment of graylog server 4.2.10 stand-alone version
ES6 deep - ES6 class class
记一次'非常诡异'的云安全组规则问题排查过程
Cheer yourself up
Dare not buy thinking
StarkWare:欲构建ZK“宇宙”
Explain in detail the functions and underlying implementation logic of the groups sets statement in SQL
面对新的挑战,成为更好的自己--进击的技术er
单商户 V4.4,初心未变,实力依旧!
《21天精通TypeScript-3》-安装搭建TypeScript开发环境.md
2020-2022 two-year anniversary of creation
Flet教程之 12 Stack 重叠组建图文混合 基础入门(教程含源码)
一些認知的思考
养不起真猫,就用代码吸猫 -Unity 粒子实现画猫咪
ES6深入—ES6 Generator 函数
【刷题篇】鹅厂文化衫问题








