当前位置:网站首页>[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);
}
边栏推荐
- 超分辨率技术在实时音视频领域的研究与实践
- "21 days proficient in typescript-3" - install and build a typescript development environment md
- Single merchant v4.4 has the same original intention and strength!
- 新春限定丨“牛年忘烦”礼包等你来领~
- 国泰君安网上开户安全吗
- EDI许可证和ICP经营性证有什么区别
- 搜索 正排索引 和 倒排索引 区别
- 效果编辑器新版上线!3D渲染、加标注、设置动画,这次一个编辑器就够了
- 漫画:什么是分布式事务?
- 迁移/home分区
猜你喜欢

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

sql中set标签的使用

HiEngine:可媲美本地的云原生内存数据库引擎

单商户 V4.4,初心未变,实力依旧!

2020-2022两周年创作纪念日

DeSci:去中心化科学是Web3.0的新趋势?

降本40%!Redis多租户集群的容器化实践

服务器的数据库连不上了2003,10060“Unknown error“【服务已起、防火墙已关、端口已开、netlent 端口不通】

Spring Festival Limited "forget trouble in the year of the ox" gift bag waiting for you to pick it up~

Flet教程之 12 Stack 重叠组建图文混合 基础入门(教程含源码)
随机推荐
vulnhub-FirstBlood
漫画:什么是服务熔断?
降本40%!Redis多租户集群的容器化实践
Find the root of the following equation by chord cutting method, f (x) =x^3-5x^2+16x-80=0
Apple 已弃用 NavigationView,使用 NavigationStack 和 NavigationSplitView 实现 SwiftUI 导航
The memory of a Zhang
效果编辑器新版上线!3D渲染、加标注、设置动画,这次一个编辑器就够了
Data access - entityframework integration
PSPNet | 语义分割及场景分析
Parameter type setting error during batch update in project SQL
Cartoon: what is distributed transaction?
[vulnerability warning] cve-2022-26134 conflict Remote Code Execution Vulnerability POC verification and repair process
今日睡眠质量记录79分
Explain in detail the functions and underlying implementation logic of the groups sets statement in SQL
list去重并统计个数
CISP-PTE之PHP伪协议总结
超分辨率技术在实时音视频领域的研究与实践
Dare not buy thinking
一些認知的思考
Spring Festival Limited "forget trouble in the year of the ox" gift bag waiting for you to pick it up~