这个题,比赛的时候一直在往dp的方向想,但是总有一个组合数学的部分没办法求,
纯粹组合数学撸,也想不到办法……
其实,很显然。。
从后往前推,把第k种颜色放在最后一个,剩下的k球,还有C(剩余的位置,k球的总数目-1)种放法
然后讨论第k-1种。。。推下去就好了
但是当时没想到……
这里要求组合数,由于比较大,用乘法逆元。。。
当然直接套lucas也是可以的。。。。
ti...
分类:
其他好文 时间:
2015-06-25 10:29:52
阅读次数:
127
554C Kyoya and Colored Balls即求 复合条件的序列数量序列最后一位必定是K。那么对于c[k]-1个剩下的K,有n-1个位置去放置。同理,对于颜色为k-1的球 在剩下的n-c[k]个位置中,必有一个在最靠右的空位置上。剩下的c[k-1]-1个球放在剩下的位置上类推core c...
分类:
其他好文 时间:
2015-06-25 06:42:50
阅读次数:
143
#1135 : Magic Box时间限制:10000ms单点时限:1000ms内存限制:256MB描述The circus clown Sunny has a magic box. When the circus is performing, Sunny puts some balls into ...
分类:
其他好文 时间:
2015-06-06 14:42:33
阅读次数:
223
题目大意:有N个人,M个篮框,K个回合,每个回合每个人可以投一颗球,每个人的命中率都是相同的P,问K回合后,投中的球的期望数是多少解题思路:因为每个人的投篮都是一个独立的事件,互不影响,所以每回合投中的球的期望数是相同的
只需求得一回合的期望再乘上K就答案了#include
#define maxn 100
double ans, p;
int n, m, k;
int c[20]...
//n个黑球,m个白球,第i个数为白球si = 0,为黑球si = 1;
//求这个串s中出现01的期望
//期望是可以加的
//那么对于第i个位置出现0第i+1出现1的概率为(n/(n+m))*(m/(n+m-1))
//那么期望为n*m/(n+m-1)
#include
#include
#include
using namespace std ;
int gcd(int a...
分类:
其他好文 时间:
2015-06-04 21:08:15
阅读次数:
139
题目链接:
The Dragon of Loowater
题面:
Problem C: The Dragon of Loowater
Once upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem.
The shores of Rellau Creek in ...
分类:
其他好文 时间:
2015-05-20 22:27:04
阅读次数:
158
对于属性,访问器函数不是必须的。
如果定义了存取器函数,应参照getVal() 和 setVal(‘Hi’)格式。
// bad
dragon.age();
// good
dragon.getAge();
// bad
dragon.age(25);
// good
dragon.setAge(25);
如果属性时boolean,格式应为isVal() or hasVal()...
分类:
编程语言 时间:
2015-05-20 09:45:38
阅读次数:
165
You probably have played the game “Throwing Balls into the Basket”. It is a simple game. You have to throw a ball into a basket from a certain distance. One day we (the AIUB ACMMER) were playing the ga...