摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2151View Code 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 using namespace std; 5 #define MAXN 111 6 int dp[MAXN][MAXN]; 7 //dp[i][j]表示第i分钟在第j棵树时的方案数 8 //dp[i][j]=dp[i-1][j-1]+dp[i-1][j+1]; 9 10 int main(){11 int n,m,p 阅读全文
posted @ 2013-05-07 23:19 ihge2k 阅读(222) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3251思路:选择1为源点,n+1为汇点,然后原图中每条边为新图的边,容量为边权,最后将每个可以选择的点与汇点连接,容量为点权,这样跑一遍最大流之后,求出最小割,然后所有的总收益减去最小割就是可能的最大收益了。View Code 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 using namespace std; 5 #define MAXN 1111 6 #define MAXM 44 阅读全文
posted @ 2013-05-07 22:39 ihge2k 阅读(316) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3657思路我就不详细讲了,这位大牛讲的很清楚:http://blog.csdn.net/cold__v__moon/article/details/7924269View Code 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #define MAXN 55 5 #define MAXM 55*55 6 #define inf 1<<30 7 using namespace 阅读全文
posted @ 2013-05-07 17:16 ihge2k 阅读(445) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4394思路:n的个位可以由m的个位确定,n的十位可以由m的个位和十位确定,以上同理,故直接bfs搜索就可以,先搜个位满足要求的,然后在满足要求的个位上扩展到十位上(其实就是就是在个位数前加个数,变成2位数)。View Code 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<queue> 5 #include<cmath> 6 using name 阅读全文
posted @ 2013-05-07 14:28 ihge2k 阅读(274) 评论(0) 推荐(0) 编辑