摘要: http://poj.org/problem?id=1659题意: 输入每个点的度 要用邻接矩阵输出可能的图havel 定理#include#include#include#includeusing namespace std;struct node{int x;int w;}no[10000];int p[1002][1002],n;int cmp(node a,node b){ return a.w>b.w;}int solve(){ int j,i,k; for(i=0;in-i-1) return -1; for(j=i+1;j<n... 阅读全文
posted @ 2013-08-05 12:06 galaxy77 阅读(226) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3249题意:给出一个有向图图 每点有一个权值 全职有正有负 找从任意一点出发的总权值最大的路径 输出其最大值用spfa 。。 初始把入度为0的点加入队列 因为数值很大 所以要用到longlong 型注意 最后输出maxx 也要是longlong型 一开始没注意到这个 wa很久 搞得人都要抓狂了#include#include#include#include#define INF 1000000000using namespace std;struct E {int to;int next;}edge[2000002];int w[10001 阅读全文
posted @ 2013-08-05 11:58 galaxy77 阅读(234) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2553#include#include//#include#include#includeusing namespace std;//vector g[1002];struct E{int to;int next;} edge[20000000];int pre[5002],low[5002],lt_num,c,scc_num[5002],scc,out0[5002],n,adj[5002],num,flag;stack s;void add(int a,int b){ edge[num].to=b; edge[num].ne... 阅读全文
posted @ 2013-08-05 11:48 galaxy77 阅读(163) 评论(0) 推荐(0) 编辑