摘要: 与第二类有些区别!#include #include #include #include #include #include #include #include #include using namespace std;#define INF 0x3ffffffftypedef long long int LL;#define N 22LL dp[N][N];LL sum[N];int main(){ //freopen("//home//chen//Desktop//ACM//in.text","r",stdin); //freopen("/ 阅读全文
posted @ 2013-07-17 18:18 chenhuan001 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 卡特兰数,第一类斯特林数,第二类斯特林数Catalan数 C(n),第一类Stirling数 s(p,k),第二类Stirling数 S(p,k)[卡特兰数,第一类斯特林数,第二类斯特林数]一.Catalan数 C(n) C(n) 的一个形象的例子是:2*n个括号,其中有n个前括号'('和n个后括号')',排成一列,满足所有括号都匹配的排列数。另一个例子是,n个1和n个-1,共2*n个数,排成一列,满足对所有0=0的排列数。 C(n)的递推公式是 C(n) = ∑(i = 0 : n-1) { C(n-1-i)*C(i) } C(n)的通项公式是 C(n) = 阅读全文
posted @ 2013-07-17 17:51 chenhuan001 阅读(393) 评论(0) 推荐(0) 编辑
摘要: 不会斯特林数的只能用递推思想了,结果发现推出来的就是斯特林数。。。#include #include #include #include #include #include #include #include #include using namespace std;#define INF 0x3fffffff#define N 1010#define __int64 long long int#define MOD 1000000007typedef __int64 LL;LL dp[N][N];LL dp1[N][N];int main(){ //freopen("//home/ 阅读全文
posted @ 2013-07-17 11:33 chenhuan001 阅读(262) 评论(0) 推荐(0) 编辑