当前位置:网站首页>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代码:
边栏推荐
猜你喜欢
随机推荐
Crawler - action chain, xpath, coding platform use
如何确定异步 I/O 瓶颈
How to write SQL statements: the usage of Update, Case, and Select together
How to automatically renew the token after it expires?
Notes for xpath getting node with namespace
小 P 周刊 Vol.13
数据库恢复
C# 动态加载卸载 DLL
期货开户之前要谈好最低手续费和交返
Phasecraft连下两城,助力英国量子技术商业化加速!
【HMS core】【Media】【视频编辑服务】 在线素材无法展示,一直Loading状态或是网络异常
CF1527D MEX Tree (mex & tree & inclusive)
利用决策树找出最优特征组合
【Web技术】1401- 图解 Canvas 入门
License server system does not support this version of this feature
开发者独立搭建一个跨模态搜索应用有多难?
[Problem solving] QT update component appears "To continue this operation, at least one valid and enabled repository is required"
Google plug-in. Download contents file is automatically deleted after solution
南瓜科学产品升级 开启益智探索新篇章
CCF GLCC officially opened | Kyushu Cloud open source experts bring generous bonuses to help universities promote open source









