当前位置:网站首页>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代码:
边栏推荐
猜你喜欢
随机推荐
The Internet of things application development trend
xampp安装包含的组件有(php,perl,apche,mysql)
[LeetCode] 38. Appearance sequence
Kyushu Cloud attended the Navigator Online Forum to discuss the current status, challenges and future of 5G MEC edge computing
关于redis的几件小事(五)redis保证高并发以及高可用
如何确定异步 I/O 瓶颈
centos7安装mysql急速版
F.金玉其外矩阵(构造)
Qt的QItemDelegate使用
Android Sqlite3 basic commands
How to Identify Asynchronous I/O Bottlenecks
JCMsuite应用:倾斜平面波传播透过光阑的传输
B.构造一个简单的数列(贪心)
vim 常用操作命令
vim common operation commands
Almost all known protein structures in the world are open sourced by DeepMind
四平方和,激光炸弹
G. Mountaineering Squad (violence & dfs)
[Opportunity Enlightenment-60]: "Soldiers, Stupid Ways"-1- Opening: "Death" and "Life" are the way of heaven
《中国综合算力指数》《中国算力白皮书》《中国存力白皮书》《中国运力白皮书》在首届算力大会上重磅发出