当前位置:网站首页>【刷題篇】鹅廠文化衫問題
【刷題篇】鹅廠文化衫問題
2022-07-05 16:31:00 【m0_60631323】
一、題目
企鹅廠活動發文化衫,文化衫有很多種,企鹅們都穿文化衫。采訪中,企鹅會說還有多少企鹅跟他穿一種文化衫。有些企鹅沒被采訪到,將這些回答放在answers數組裏,返回活動中企鹅的最少數
二、題解
2.1思路



2.2源碼
源碼:
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);
}
边栏推荐
- Record a 'very strange' troubleshooting process of cloud security group rules
- ES6 drill down - Async functions and symbol types
- EDI许可证和ICP经营性证有什么区别
- vulnhub-FirstBlood
- sql中set标签的使用
- The new version of effect editor is online! 3D rendering, labeling, and animation, this time an editor is enough
- 国泰君安网上开户安全吗
- Enter a command with the keyboard
- Enterprise backup software Veritas NetBackup (NBU) 8.1.1 installation and deployment of server
- Global Data Center released DC brain system, enabling intelligent operation and management through science and technology
猜你喜欢
随机推荐
Cs231n notes (medium) -- applicable to 0 Foundation
How to use FRP intranet penetration +teamviewer to quickly connect to the intranet host at home when mobile office
Five common negotiation strategies of consulting companies and how to safeguard their own interests
Cartoon: what is MapReduce?
单商户 V4.4,初心未变,实力依旧!
数据湖(十四):Spark与Iceberg整合查询操作
list使用Stream流进行根据元素某属性数量相加
[vulnerability warning] cve-2022-26134 conflict Remote Code Execution Vulnerability POC verification and repair process
[深度学习][原创]让yolov6-0.1.0支持yolov5的txt读取数据集模式
List uses stream flow to add according to the number of certain attributes of the element
Enterprise backup software Veritas NetBackup (NBU) 8.1.1 installation and deployment of server
list去重并统计个数
Flet教程之 09 NavigationRail 基础入门(教程含源码)
降本40%!Redis多租户集群的容器化实践
Mistakes made when writing unit tests
Pits encountered in the use of boolean type in development
2020-2022 two-year anniversary of creation
Mongodb getting started Tutorial Part 04 mongodb client
Cartoon: what is blue-green deployment?
二叉树相关OJ题









