11609 TeamsIn a galaxy far far away there is an ancient game played among the planets. The specialty of the gameis that there is no limitation on the ...
分类:
其他好文 时间:
2016-09-07 21:01:40
阅读次数:
136
I - Teams
Time Limit:1000MS Memory Limit:0KB 64bit IO Format:%lld
& %llu
Submit Status Practice UVA
11609
题意:有n个人,选多个人参加比赛,其中一个是队长,队长不同其他选手相同也算作不同的方案,。问你一共有多少种方案。
思路:自己才纸上稍微推理一下,n...
分类:
其他好文 时间:
2015-06-11 23:02:56
阅读次数:
139
I -Teams Time Limit:1000MSMemory Limit:0KB64bit IO Format:%lld & %lluSubmitStatusPracticeUVA 11609题意:有n个人,选多个人参加比赛,其中一个是队长,队长不同其他选手...
分类:
其他好文 时间:
2015-06-11 21:02:01
阅读次数:
140
题目链接
题意:从N个人中选出K个人为一只队伍(1
思路:依题目可得ans = sum(i * C(i, n)),化简可得ans = n * sum(C(i, n - 1)) = n * 2 ^ (n - 1)。之后用快速幂求解。
代码:
#include
#include
#include
#include
#include
typedef long...
分类:
其他好文 时间:
2014-09-11 22:29:52
阅读次数:
255
先选人,再从这些人里选一个队长,方案总数:C(i,1)*C(n,i)(其中i从1到n)的总和。这个公式显然不能在时限内暴力算出来,需要变形和推导出更简单的来。用到组合数里面这个公式:C(n,k)*C(k,r)=C(n,r)*C(n-r,k-r)(其中r#include#include#include...
分类:
其他好文 时间:
2014-08-30 01:16:18
阅读次数:
239