当前位置:网站首页>[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);
}
边栏推荐
- RLock锁的使用
- One click installation script enables rapid deployment of graylog server 4.2.10 stand-alone version
- Is it safe for Guotai Junan to open an account online
- Flet教程之 11 Row组件在水平数组中显示其子项的控件 基础入门(教程含源码)
- ES6 drill down - ES6 generator function
- Accès aux données - intégration du cadre d'entité
- Research and practice of super-resolution technology in the field of real-time audio and video
- 抽象类中子类与父类
- 自己要有自己的坚持
- 10 minutes to help you get ZABBIX monitoring platform alarm pushed to nail group
猜你喜欢

有序链表集合求交集 方法 总结

OneForAll安装使用

Cs231n notes (medium) -- applicable to 0 Foundation

【深度学习】深度学习如何影响运筹学?

ES6 drill down - Async functions and symbol types

数据访问 - EntityFramework集成

2020-2022 two-year anniversary of creation

List de duplication and count the number
Intel 13th generation Raptor Lake processor information exposure: more cores, larger cache

极坐标扇图使用场景与功能详解
随机推荐
tf.sequence_mask函数讲解案例
Migrate /home partition
为季前卡牌游戏 MotoGP Ignition Champions 做好准备!
Data Lake (XIV): spark and iceberg integrated query operation
用键盘输入一条命令
Practice independent and controllable 3.0 and truly create the open source business of the Chinese people
给自己打打气
Data access - entityframework integration
漫画:什么是蓝绿部署?
Cartoon: what is the eight queens problem?
漫画:什么是分布式事务?
sql中set标签的使用
Apiccloud cloud debugging solution
普洛斯数据中心发布DC Brain系统,科技赋能智慧化运营管理
超分辨率技术在实时音视频领域的研究与实践
How to use FRP intranet penetration +teamviewer to quickly connect to the intranet host at home when mobile office
【网易云信】超分辨率技术在实时音视频领域的研究与实践
Research and development efficiency measurement index composition and efficiency measurement methodology
vulnhub-FirstBlood
Win11 prompt: what if the software cannot be downloaded safely? Win11 cannot download software safely