摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3177Crixalis's EquipmentTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 594Accepted Submission(s): 229Problem DescriptionCrixalis - Sand King used to be a giant scorpion(蝎子) in the deserts of Kalimdor. 阅读全文
posted @ 2011-07-27 18:08 Crazy_yiner 阅读(807) 评论(0) 推荐(0) 编辑
摘要: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3279AntsTime Limit:2 Seconds Memory Limit:32768 KBecho is a curious and clever girl, and she is addicted to the ants recently.She knows that the ants are divided into many levels depends on ability, also, she finds the number of each level 阅读全文
posted @ 2011-07-27 17:49 Crazy_yiner 阅读(295) 评论(0) 推荐(0) 编辑
摘要: 有多个发电站 中转站 和用户 多源 多汇的最大流问题 建立源点 和 汇点 将发电站连到源点上将用户连到汇点上求图的最大流#include<iostream>#include<queue>#include<stdio.h>#include<cstring>using namespace std;#define INF 0x7fffffffint cap[503][503],a[503],p[503];int ek(int s,int t,int n){ int f=0; while(1) { queue<int> q; memset(a 阅读全文
posted @ 2011-07-26 22:50 Crazy_yiner 阅读(138) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>#include<map>#include<string>#include<stdio.h>#include<cstring>#include<queue>using namespace std;const int INF=0x7fffffff;int cap[503][503],a[503],flow[503][503],p[503];int ek(int s,int t,int n){ memset(flow,0,sizeof(flow)); int f=0; while(1) { 阅读全文
posted @ 2011-07-23 20:42 Crazy_yiner 阅读(176) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>#include<stdio.h>#include<queue>#include<cstring>using namespace std;#define INF 1000000000#define MAXN 1000int a[MAXN];int cap[MAXN][MAXN],flow[MAXN][MAXN],p[MAXN];queue<int>q;int main(){ int n,m; while(cin>>n>>m) { memset(cap,0,sizeof(cap 阅读全文
posted @ 2011-07-20 23:16 Crazy_yiner 阅读(279) 评论(0) 推荐(0) 编辑
摘要: DescriptionHere’s a simple graph problem: Find the shortest pathfrom the top-middle vertex to the bottom-middle vertexin a given tri-graph. A tri-graph is an acyclic graph of(N ≥ 2) rows and exactly 3 columns. Unlike regulargraphs, the costs in a tri-graph are associated with thevertices rather than 阅读全文
posted @ 2011-07-19 20:40 Crazy_yiner 阅读(201) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>#include<stdio.h>#include<string>using namespace std;#define MAX 50000int sum1;struct Node{ int left,right,sum;}stu[3*MAX];void CreateTree(int ii,int a,int b)//建树的结果只是形成一个空箱子 里面什么东西都没有 只有区间的两端{ stu[ii].left = a; stu[ii].right = b; stu[ii].sum = 0; if(a == b) { ret 阅读全文
posted @ 2011-07-14 16:13 Crazy_yiner 阅读(216) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>#include<stdio.h>using namespace std;#define MAX 200001int big;struct Node{ int r,l,max;}s[MAX*3];int Max(int a,int b){ return a>b?a:b;}void creat(int i,int a,int b){ s[i].l=a; s[i].r=b; s[i].max=0; if(a==b) return; else { int mid=(a+b)>>1; creat(i*2,a,mid); cr 阅读全文
posted @ 2011-07-13 10:03 Crazy_yiner 阅读(354) 评论(1) 推荐(0) 编辑
摘要: strcmp: 用于比较两个字符串,原型如下:int strcmp ( char const *s1, char const *s2);如果s1小于s2,strcmp函数返回一个小于零的值。如果s1大于s2,函数返回一个大于零的值。如果两个字符串相等,函数就返回零。警告:初学者常常会编写下面这样的表达式 if ( strcmp (a, b)) 他以为如果两个字符串相等,它的结果将是真。但是,这个结果将正好相反,因为在两个字符串相等的情况下返回值是零(假)。 把这个返回值当作布尔值进行测试是一种坏风格,因为它具有三个截然不同的结果:小于、等于和大于。 所以更好的方法是把这个返回值与零进行比较。当 阅读全文
posted @ 2011-07-13 10:02 Crazy_yiner 阅读(38658) 评论(0) 推荐(2) 编辑
摘要: /*两次单源最短路径 输入的时候一次正向记录路径一次反向记录路径 */#include<iostream>#include<cstring>#include<stdio.h>#include<algorithm>using namespace std;#define INF 99999int t[1001][1001],dd[1001][1001];int v[1001],dp[1001],dp2[1001];int n,w;void f(int d[][1001]){ memset(v,0,sizeof(v)); for(int i=1;i&l 阅读全文
posted @ 2011-07-11 12:31 Crazy_yiner 阅读(518) 评论(0) 推荐(0) 编辑