USACO: Cow Pedigrees dp
2013-03-08 20:03
225 查看
/* ID: Jang Lawrence PROG: nocows LANG: C++ */ #include<iostream> #include<cstring> #include<cstdio> #include<algorithm> #include<queue> using namespace std; typedef long long lng; int f(lng x) { return (x%9901+9901)%9901; } int n,k; lng dp[201][101]; int main() { #ifndef DEBUG freopen("nocows.in","r",stdin); freopen("nocows.out","w",stdout); #endif scanf("%d%d",&n,&k); for(int i=1;i<=k;++i) dp[1][i]=1; for(int i=3;i<=n;i+=2) for(int j=1;j<=k;++j) { for(int s=1;s<i-1;s+=2) dp[i][j]=f(dp[i][j]+dp[s][j-1]*dp[i-1-s][j-1]); } int u=f(dp [k]-dp [k-1]); printf("%d\n",u); return 0; }
相关文章推荐
- USACO / Cow Pedigrees(DP)
- USACO Cow Pedigrees, DP经典入门讲解
- 1633: [Usaco2007 Feb]The Cow Lexicon 牛的词典(DP)
- BZOJ1649: [Usaco2006 Dec]Cow Roller Coaster 背包DP
- 【BZOJ1649】[Usaco2006 Dec]Cow Roller Coaster【背包DP】
- 树形dp——洛谷 P2986 [USACO10MAR]伟大的奶牛聚集Great Cow Gat…
- [USACO10MAR]伟大的奶牛聚集Great Cow Gat…【树形dp】By cellur925
- BZOJ1633: [Usaco2007 Feb]The Cow Lexicon 牛的词典 DP
- usaco Cow Pedigrees
- bzoj4745[USACO16DEC]Cow Checklist (DP)
- 【BZOJ】1633: [Usaco2007 Feb]The Cow Lexicon 牛的词典(dp)
- 【BZOJ】1649: [Usaco2006 Dec]Cow Roller Coaster(dp)
- bzoj 1633: [Usaco2007 Feb]The Cow Lexicon 牛的词典【dp】
- 累加型DP—— [Usaco2006 Oct]Cow Pie Treasures 馅饼里的财富
- BZOJ 1633 [Usaco2007 Feb]The Cow Lexicon 牛的词典(单调DP)
- |BZOJ 1633|字符串DP|[Usaco2007 Feb]The Cow Lexicon 牛的词典
- bzoj 1649: [Usaco2006 Dec]Cow Roller Coaster【dp】
- BZOJ 1668: [Usaco2006 Oct]Cow Pie Treasures 馅饼里的财富( dp )
- 【BZOJ1633】[Usaco2007 Feb]The Cow Lexicon 牛的词典【DP】
- USACO Cow Pedigrees