Examining the Rooms - 第一类斯特灵数】的更多相关文章

---恢复内容开始--- 2017-08-10 20:32:37 writer:pprp 题意如下: Recently in Teddy's hometown there is a competition named "Cow Year Blow Cow".N competitors had took part in this competition.The competition was so intense that the rank was changing and changi…
<题目链接> <转载于 >>> > 题目大意:有n个锁着的房间和对应n扇门的n把钥匙,每个房间内有一把钥匙.你可以破坏一扇门,取出其中的钥匙,然后用取出钥匙打开另一扇门(如果取出的钥匙能打开房门则接着打开,取出其中钥匙,如此往复,若打不开则继续破坏一扇门).最多可以破坏k(k<=n)扇门,但是编号为1的门只能用钥匙打开.求能打开所有门(被破坏或是被钥匙打开)的概率. 解题分析: 钥匙和门的关系是成环状的,打开一个门之后,该环内的所有房间都可以进入,怎么说呢,…
2017-08-10 21:10:08 writer:pprp //TLE #include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <algorithm> using namespace std; const int INF = 0x3f3f3f3f; typedef long long…
[HDU 3625]Examining the Rooms (第一类斯特林数) 题面 有n个房间,每个房间有一个钥匙,钥匙等概率的出现在n个房间内,每个房间中只会出现且仅出现一个钥匙.你能炸开门k次,问你能进入所有房间的概率.特殊要求:不能炸1号房间的门. T组询问 T<=2000,k<=n<=2000 分析 前置知识(如果你了解斯特林数,可以跳过) 圆排列:把n个元素排在一个圆周上,如果旋转之后两个圆周上的排列一样,那么这两个排列相同 第一类斯特林数S(n,m)表示把n个不同元素构成m…
题意 题目链接 Sol 这篇题解写的非常详细 首先要知道第二类斯特灵数的一个性质 \[m^n = \sum_{i = 0}^m C_{n}^i S(n, i) i!\] 证明可以考虑组合意义:\(m^n\)是把\(n\)个不同的球放到\(m\)个不同的盒子里的方案数 然后用这个式子展开\(i^k\),把组合数展开,会得到这样一个式子 \[\sum_{i=1}^n\frac{n!}{(n-i)!}\sum_{j=0}^i\frac{S(k,j)}{(i-j)!}\] 发现不是很好搞,但是考虑到当\…
Examining the Rooms Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1305    Accepted Submission(s): 796 Problem Description A murder happened in the hotel. As the best detective in the town, yo…
题目:http://acm.hdu.edu.cn/showproblem.php?pid=3625 学习斯特林数:https://blog.csdn.net/qq_33229466/article/details/75042895 https://www.cnblogs.com/gzy-cjoier/p/8426987.html http://www.cnblogs.com/zhouzhendong/p/Stirling-Number.html 关于这道题: 得到一把钥匙后,可以连续开的门与钥匙…
题目:http://acm.hdu.edu.cn/showproblem.php?pid=3625 n^2 求斯特林数就行.要减去的就是1号钥匙在1号房间的方案,即 s[ n-1 ][ m-1] . 注意是 <=m . #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #define ll long long using namespace std; ;…
@维基百科 在组合数学,Stirling数可指两类数,都是由18世纪数学家James Stirling提出的. 第一类 s(4,2)=11 第一类Stirling数是有正负的,其绝对值是个元素的项目分作个环排列的方法数目.常用的表示方法有. 换个较生活化的说法,就是有个人分成组,每组内再按特定顺序围圈的分组方法的数目.例如: {A,B},{C,D} {A,C},{B,D} {A,D},{B,C} {A},{B,C,D} {A},{B,D,C} {B},{A,C,D} {B},{A,D,C} {C…
2017-08-10 20:32:37 writer:pprp 题意如下: Recently in Teddy's hometown there is a competition named "Cow Year Blow Cow".N competitors had took part in this competition.The competition was so intense that the rank was changing and changing. Now the q…