摘要:
转载请注明出自cxb569262726:http://write.blog.csdn.net/postedit题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=2544代码:#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAXN 105
#define INF 100000
using namespace std;
int map[MAXN][MAXN],used[105],d[105 阅读全文
随笔分类 - c++
两行代码,理解了一个小时! 两个数组记录邻接表! ( 刘汝佳白书)
2012-08-05 00:53 by java环境变量, 190 阅读, 收藏,
摘要:
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<queue>
#include<math.h>
#include<set>
#include<vector>
#define MAXN 15
#define INF 1000
int main()
{ int i,j,n,m,t,c; int first[MAXN]; int u[M 阅读全文
HDU 1151Air Raid 最小路径覆盖=n-最大匹配量 (第二道二分匹配)
2012-07-30 03:44 by java环境变量, 232 阅读, 收藏,
摘要:
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
using namespace std;
int map[125][125],ve[125],vs[125];
int s,e; int getpath(int u)
{ int i; for(i=1;i<=s;i++) { if(!map[u][i] || ve[i]) continue; .. 阅读全文
HDU 2063过山车 解题报告(我的第一道二分匹配)
2012-07-30 02:36 by java环境变量, 376 阅读, 收藏,
摘要:
题目连接http://acm.hdu.edu.cn/showproblem.php?pid=2063下面是复制别人的解析后根据我不懂的地方自己补充修改的:二部图(也叫二分图)概念:1.何为二部图 如果V(G)可以分到两个集合X,Y中,且X和Y内部没有G的边.那么图G就是一个二部图(等价于图G是可二顶点着色的)下图便是一个二部图. 2.二部图的性质 一个图是二部图当且仅当图G中没有奇环.比如说一个三角形就不可能分成两个部分,并且每个部分内部没有边,但一个正方形就可以.3.如何得到二部图的每个部分 任意选一个顶点,所有到该点距离为偶数的点构成的集合便是G中的一部分,距离为奇数的点为另一部分... 阅读全文
HDU 1114Piggy-Bank(完全背包) 解题报告
2012-07-29 21:10 by java环境变量, 258 阅读, 收藏,
摘要:
Problem DescriptionBefore ACM can do anything, a budget must be prepared and the necessary financial support obtained. The main income for this action comes from Irreversibly Bound Money (IBM). The idea behind is simple. Whenever some ACM member has any small money, he takes all the coins and throws 阅读全文
HDU 4252 A Famous City 解题报告
2012-07-20 09:56 by java环境变量, 275 阅读, 收藏,
摘要:
A Famous CityTime Limit: 10000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 472Accepted Submission(s): 190Problem DescriptionAfter Mr. B arrived in Warsaw, he was shocked by the skyscrapers and took several photos. But now when he looks at these photos, he finds 阅读全文
HDU 2546 饭卡(01背包) 解题报告
2012-07-18 09:10 by java环境变量, 248 阅读, 收藏,
摘要:
原文链接: http://acm.hdu.edu.cn/showproblem.php?pid=2546昨天吧背包九讲中最基础的01背包看完,做了2602。结果晚上比赛相同题目却做不出。。苦想几个小时。。。解题思路:要使剩余钱最少,应该留下块钱买最贵的东西(标记为t)(注意金额m<5 的情况!!) 接下来就是用剩下的m-5元买除t以外的菜。每种菜只能买一次。就构成背包问题。代码:#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include& 阅读全文
浙公网安备 33010602011771号