当前位置:网站首页>[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);
}
边栏推荐
- Win11 prompt: what if the software cannot be downloaded safely? Win11 cannot download software safely
- Apple 已弃用 NavigationView,使用 NavigationStack 和 NavigationSplitView 实现 SwiftUI 导航
- Convert obj set to entity set
- 漫画:什么是蓝绿部署?
- 解决CMakeList find_package找不到Qt5,找不到ECM
- [echart] resize lodash to realize chart adaptation when window is zoomed
- 10 minutes to help you get ZABBIX monitoring platform alarm pushed to nail group
- Global Data Center released DC brain system, enabling intelligent operation and management through science and technology
- Solve the Hanoi Tower problem [modified version]
- 面对新的挑战,成为更好的自己--进击的技术er
猜你喜欢

文件操作--I/O

2020-2022 two-year anniversary of creation

Research and development efficiency measurement index composition and efficiency measurement methodology

《21天精通TypeScript-3》-安装搭建TypeScript开发环境.md

极坐标扇图使用场景与功能详解

scratch五彩糖葫芦 电子学会图形化编程scratch等级考试三级真题和答案解析2022年6月

数据湖(十四):Spark与Iceberg整合查询操作

【学术相关】多位博士毕业去了三四流高校,目前惨不忍睹……

Parameter type setting error during batch update in project SQL

ES6 deep - ES6 class class
随机推荐
Some cognitive thinking
list去重并统计个数
Apiccloud cloud debugging solution
文件操作--I/O
Seaborn draws 11 histograms
數據訪問 - EntityFramework集成
Practice independent and controllable 3.0 and truly create the open source business of the Chinese people
[deep learning] [original] let yolov6-0.1.0 support the txt reading dataset mode of yolov5
APICloud云调试解决方案
Batch update in the project
Research and practice of super-resolution technology in the field of real-time audio and video
漫画:什么是蓝绿部署?
后台系统发送验证码功能
Desci: is decentralized science the new trend of Web3.0?
《21天精通TypeScript-3》-安装搭建TypeScript开发环境.md
怎样在电脑上设置路由器的WiFi密码
求解汉诺塔问题【修改版】
How can programmers improve their situation?
ES6深入—ES6 Class 类
ES6 deep - ES6 class class