当前位置:网站首页>[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);
}
边栏推荐
- You should have your own persistence
- [Netease Yunxin] research and practice of super-resolution technology in the field of real-time audio and video
- 利用GrayLog告警功能实现钉钉群机器人定时工作提醒
- 2020-2022 two-year anniversary of creation
- 《21天精通TypeScript-3》-安装搭建TypeScript开发环境.md
- One click installation script enables rapid deployment of graylog server 4.2.10 stand-alone version
- Summary of methods for finding intersection of ordered linked list sets
- How does win11 change icons for applications? Win11 method of changing icons for applications
- Mistakes made when writing unit tests
- 阿掌的怀念
猜你喜欢

Subclasses and superclasses of abstract classes

Single merchant v4.4 has the same original intention and strength!

Use of set tag in SQL

Batch update in the project

Research and development efficiency measurement index composition and efficiency measurement methodology

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

Flet教程之 09 NavigationRail 基础入门(教程含源码)

视觉体验全面升级,豪威集团与英特尔Evo 3.0共同加速PC产业变革

新春限定丨“牛年忘烦”礼包等你来领~
随机推荐
You should have your own persistence
二叉树相关OJ题
Some cognitive thinking
利用GrayLog告警功能实现钉钉群机器人定时工作提醒
Relationship between objects and classes
Research and practice of super-resolution technology in the field of real-time audio and video
ES6深入—ES6 Generator 函数
Flet教程之 11 Row组件在水平数组中显示其子项的控件 基础入门(教程含源码)
抽象类中子类与父类
数据访问 - EntityFramework集成
list使用Stream流进行根据元素某属性数量相加
Pspnet | semantic segmentation and scene analysis
Data Lake (XIV): spark and iceberg integrated query operation
Apiccloud cloud debugging solution
ES6 drill down - Async functions and symbol types
Cs231n notes (medium) -- applicable to 0 Foundation
自己要有自己的坚持
Research and development efficiency measurement index composition and efficiency measurement methodology
Subclasses and superclasses of abstract classes
Use of set tag in SQL