上一页 1 2 3 4 5 6 7 8 ··· 15 下一页
摘要: http://poj.org/problem?id=2983题意:给出一些相对位置,问给出的数据是否正确;如样例一 P 1 2 1 表示1在2前面恰好一个单位,V 1 3 表示1在3前面至少一个单位x1-x2=1 <=>x1-x2>=1 && x2-x1>=-1 (把等式变成两个不等式)样例一列出的 不等式为x1-x2>=1 (1)x2-x1>=-1x2-x3>=1 (2)x3-x2>=-1x1-x3>=1x1-x3>=1x3-x1>=-1(3)(1)(2)(3)左右各相加 得 0>=1 错误, 所以如果有 阅读全文
posted @ 2012-08-09 10:12 快乐. 阅读(91) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1201学习差分约束的几个bloghttp://fuliang.iteye.com/blog/368214http://www.cppblog.com/y346491470/articles/152876.html题意:给出一些区间,从每个区间中至少选择一些点,问从所有的区间中至少选多少点菜满足条件求最小,所以用最长路求spfa代码:#include<iostream>#include<cstdio>#include<cstring>#include<string>#define nMAX 50 阅读全文
posted @ 2012-08-08 21:32 快乐. 阅读(168) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2135 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<string> 5 #define nMAX 1002 6 #define mMAX 10005 7 #define inf 99999999 8 using namespace std; 9 int head[nMAX],qu[nMAX],dis[nMAX],pre[nMAX]; 10 bool vs[nMAX]; 11 int n,s_edg 阅读全文
posted @ 2012-08-07 12:42 快乐. 阅读(149) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1704看完这个题,一点思路都没有。看的这个blog感觉挺好http://www.cnblogs.com/AndreMouche/archive/2011/03/27/1996762.html把每两个分成一组,每组两个数间的距离看成石子数量,改变这两个石子的距离才会影响局势代码:#include<iostream>#include<cstdio>#include<cstring>#include<cmath>#include<algorithm>#define nMAX 1002us 阅读全文
posted @ 2012-05-09 17:13 快乐. 阅读(137) 评论(0) 推荐(0) 编辑
摘要: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=3367关键按字典序输出。。。死了多少脑细胞啊!!!代码:#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>#define nMAX 102using namespace std;int root[nMAX];int n,s_edge,cnt;struct Edge{ int u,v,w;}edge[nMAX*nMAX],ans[nMAX*n 阅读全文
posted @ 2012-05-07 17:09 快乐. 阅读(158) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1830题意:汉语哎。。。建方程有个资料http://blog.csdn.net/shiren_Bod/article/details/5766907X1*A(1,1)1+X2*A(1,2)1+X3*A(1,3)1+…………X30*A(30,30)1=L1;mod 2X1*A(1,1)2+X2*A(1,2)2+X3*A(1,3)2+…………X30*A(30,30)2=L2;mod 2X1*A(1,1)3+X2*A(1,2)3+X3*A(1,3)3+…………X30*A(30,30)3=L3mod 2…….…….…….X1*A(1,1)30+X2 阅读全文
posted @ 2012-05-06 21:12 快乐. 阅读(346) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3395A fish will spawn after it has been attacked. Each fish can attack one other fish and can only be attacked once.用KM,当时用最小费用最大流的时候老是WA看了AC神的 blog http://hi.baidu.com/aekdycoin/blog/item/3bc9df1fa2327d1340341755.html !!! 以后构图注意了代码(第一个最大费用最大流):#include<i 阅读全文
posted @ 2012-05-03 22:14 快乐. 阅读(245) 评论(0) 推荐(0) 编辑
摘要: poj 1330 http://poj.org/problem?id=1330最基础的了吧代码:#include<iostream>#include<cstdio>#include<string>#include<cstring>#define nMAX 10005using namespace std;int head[nMAX],parent[nMAX];bool vs[nMAX],use[nMAX],fg;int s_edge,n,start,end;struct Edge{ int v,nxt;}edge[nMAX];void added 阅读全文
posted @ 2012-05-01 16:07 快乐. 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 大神博客 http://hi.baidu.com/scameeling/blog/item/60f25a8dc50347e3f01f36f0.html#0连通图的割点、割边(桥)、块、缩点,有向图的强连通分量2010-08-04 20:42一、基本概念无向图割点:删掉它之后(删掉所有跟它相连的边),图必然会分裂成两个或两个以上的子图。块:没有割点的连通子图割边:删掉一条边后,图必然会分裂成两个或两个以上的子图,又称桥。缩点:把没有割边的连通子图缩为一个点,此时满足任意两点间都有两条路径相互可达。求块跟求缩点非常相似,很容易搞混,但本质上完全不同。割点可以存在多个块中(假如存在k个块中),最终该 阅读全文
posted @ 2012-04-30 19:19 快乐. 阅读(203) 评论(0) 推荐(0) 编辑
摘要: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2972状态转移方程 前面推后面 跟gone finshing 有点。。。代码:#include<iostream>#include<cstdio>#include<string>#include<cstring>#define inf 1<<30#include<algorithm>using namespace std;int dp[115][115];int T1,T2,T3,F1,F2;int 阅读全文
posted @ 2012-04-28 21:22 快乐. 阅读(163) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 15 下一页