当前位置:网站首页>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代码:
边栏推荐
猜你喜欢
随机推荐
在腾讯,我的试用期总结!
Technology sharing | Description of the electronic fence function in the integrated dispatching system
leetcode:255 验证前序遍历序列二叉搜索树
C# 动态加载卸载 DLL
vim common operation commands
Almost all known protein structures in the world are open sourced by DeepMind
How to install postgresql and configure remote access in ubuntu environment
技术分享| 小程序实现音视频通话
Win11勒索软件防护怎么打开?Win11安全中心勒索软件防护如何设置
输入输出流总结
ACL 2022 | 社会科学理论驱动的言论建模
Notes for xpath getting node with namespace
从理论到实践:MySQL性能优化和高可用架构,一次讲清
leetcode:250. 统计同值子树
Qt的QItemDelegate使用
F. Jinyu and its outer matrix (construction)
【 HMS core 】 【 Media 】 online video editing service 】 【 material can't show, or network anomalies have been Loading state
eyb:JWT介绍
Why does the decimal point appear when I press the space bar in word 2003?
阴影初始化【5】