POJ 3088】的更多相关文章

题意:有一个n个按钮的锁,按下一些按钮打开门,有多少开门方式,其中,一些按钮可以选,可以不选,选中的按钮 可以分成一些集合,集合之间无序,是同时按下的. 分析: 1.首先选择 i 个按钮,组合数 2.枚举分成的集合 3.i 个按钮分成无序集合,第二类斯特林数 4.集合之间有序,排列数 #include <cstdio> #include <algorithm> #include <cmath> #include <cstring> using namespa…
已知n,求n中取k(k<=n)个数组成的m(m<=n)个的集合的排列数. 于是,可以枚举选出k个数及枚举m个集合.这个很明显是二类斯特林数.而集合有序,则乘上m! #include <iostream> #include <cstdio> #include <algorithm> #define LL __int64 using namespace std; LL con_mul[15],Str[15][15]; void initial(){ con_mu…
题意:N个编号为1~N的数,选任意个数分入任意个盒子内(盒子互不相同)的不同排列组合数. 解法:综合排列组合 Stirling(斯特林)数的知识进行DP.C[i][j]表示组合,从i个数中选j个数的方案数:S[i][j]表示Stirling数,i个数分成j份的方案数:P[i]表示P(i,i)全排列.分别从N个数中选i个数后,这i个数分成j份(j=1~i),进入j个盒子内,j个盒子有不同的排列.因此,对于N个数的公式为:ans=sum{C[n][i]*sum{S[i][j]*P[j]}}; P.S…
Halloween treats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 7644   Accepted: 2798   Special Judge Description Every year there is the same problem at Halloween: Each neighbour is only willing to give a certain total number of sweets…
Find a multiple Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7192   Accepted: 3138   Special Judge Description The input contains N natural (i.e. positive integer) numbers ( N <= 10000 ). Each of that numbers is not greater than 15000…
The Pilots Brothers' refrigerator Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22286   Accepted: 8603   Special Judge Description The game “The Pilots Brothers: following the stripy elephant” has a quest where a player needs to open a…
Flip Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 37427   Accepted: 16288 Description Flip game is played on a rectangular 4x4 field with two-sided pieces placed on each of its 16 squares. One side of each piece is white and the…
Corn Fields Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9806   Accepted: 5185 Description Farmer John has purchased a lush new rectangular pasture composed of M by N (1 ≤ M ≤ 12; 1 ≤ N ≤ 12) square parcels. He wants to grow some yumm…
Sum of Consecutive Prime Numbers Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 20050   Accepted: 10989 Description Some positive integers can be represented by a sum of one or more consecutive prime numbers. How many such representatio…
Tree Recovery Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 11939   Accepted: 7493 Description Little Valentine liked playing with binary trees very much. Her favorite game was constructing randomly looking binary trees with capital le…