摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1133卡特兰数的应用:(C(m+n,n)-C(m+n,m+1))*m!*n!化简即(m+n)!*(m-n+1)/(m+1)string处理比较方便。。。View Code 1 #include<iostream> 2 #include<algorithm> 3 #include<string> 4 #include<vector> 5 using namespace std; 6 vector<string>vet; 7 8 string 阅读全文
posted @ 2013-03-23 17:30 ihge2k 阅读(271) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2189思路:dp[i][j]表示用最大不超过i的素数组成整数j的最多的方法。1、若i不是素数,则dp[i][j]=dp[i-1][j];2、否则,dp[i][j]=d[i-1][j]+dp[i][j-i];View Code 1 #include<iostream> 2 #include<cmath> 3 #include<cstring> 4 const int N=170; 5 using namespace std; 6 int prime[N]; 7 in 阅读全文
posted @ 2013-03-23 14:26 ihge2k 阅读(259) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4514Tencent昨天比赛的题目,昨天看的时候没什么思路,今天在网上搜了一下,说是可以用并查集做。。。果然,过了。。。看来还是做的题不够多啊!!!思路:并查集判环,并把每次的边权值都加到根结点的上去,最后求每个根结点权值的最大值就行了。。。orzView Code 1 #include<iostream> 2 #include<cstring> 3 const int N=100007; 4 using namespace std; 5 struct Edge{ 6 int 阅读全文
posted @ 2013-03-23 10:17 ihge2k 阅读(1002) 评论(2) 推荐(0) 编辑