当前位置:网站首页>Hangzhou electric the competition team arrangement (ACM)
Hangzhou electric the competition team arrangement (ACM)
2022-08-04 14:35:00 【51CTO】
ACMTeam arrangement
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1039 Accepted Submission(s): 502
Problem Description
ACMThe Asian competition is over,It means that preparations for next year's Zhejiang University Student Programming Contest have begun! 杭州电子科技大学ACMThe training team is also ready to start forming teams. The coach wants to take it allnThe players form several teams,The principle is that each team has at least one person,最多三人. 现在问题来了:If the number of players in the training team is knownn,Please help the coach to figure out how many possible team formations there are. 特别说明: Teams are not numbered,即如果有A,B,C三人,{A}{BC}与{BC}{A}It's the same team situation.
Input
输入包含多组测试数据(约1000组),每组数据占一行,包含一个数字n(0<=n<=20),表示ACMThe number of players in the training team;n为0,表示输入结束.
Output
请输出nThe number of all possible team plans for a player,每组输出占一行.
Sample Input
1 2 3 4 5 0
Sample Output
1 2 5 14 46
思路:There was no idea at first,Did not expect it to be recursive,a[i]表示第isituation of a team
a[i] = a[i-1] + a[i-2] * C(i-1,1) + a[i-3] * C(i-1,2);
表示第iForm your own team+从i-1Choose one and the firstiIndividual team,The rest team up+从i-1个人里面选2个和第iIndividual team,The rest team up
AC代码:
边栏推荐
猜你喜欢

从理论到实践:MySQL性能优化和高可用架构,一次讲清

期货开户之前要谈好最低手续费和交返

MySQL【窗口函数】【共用表表达式】

利用决策树找出最优特征组合
![[The Art of Hardware Architecture] Study Notes (1) The World of Metastability](/img/ac/54e4e13d9df90e96933c69623b770e.png)
[The Art of Hardware Architecture] Study Notes (1) The World of Metastability

零基础可以转行软件测试吗 ?这篇文章告诉你
![[LeetCode] 38. Appearance sequence](/img/d6/092796b57844d5d30f3ed123a1b98a.png)
[LeetCode] 38. Appearance sequence

This week to discuss the user experience: Daedalus Nemo to join Ambire, explore the encryption of the ocean

郑轻新生校赛和中工选拔赛题解

编译型与解释型编程语言的区别
随机推荐
[Opportunity Enlightenment-60]: "Soldiers, Stupid Ways"-1- Opening: "Death" and "Life" are the way of heaven
【历史上的今天】8 月 4 日:第一位图灵奖女性得主;NVIDIA 收购 MediaQ;首届网络安全挑战大赛完成
并发程序的隐藏杀手——假共享(False Sharing)
如何在ubuntu环境下安装postgresql并配置远程访问
vim 常用操作命令
Lecture 4 SVN
阿里老鸟终于把测试用例怎么写说的明明白白了,小鸟必看
The Internet of things application development trend
基于 Next.js实现在线Excel
eyb:JWT介绍
四平方和,激光炸弹
开发者独立搭建一个跨模态搜索应用有多难?
编程思想_编程有必要给孩子学吗?
【剑指offer59】队列的最大值
如何确定异步 I/O 瓶颈
leetcode:253. 至少需要多少间会议室
七夕邂逅爱,那人一定在
Centos7 install mysql version rapidly
[Beiya data recovery] IBM System Storage storage lvm information lost data recovery solution
【Web技术】1401- 图解 Canvas 入门