05 2013 档案

摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 8 const int maxn = 100; 9 const int INF = 0x3f3f3f3f;10 int cap[maxn][maxn];11 int flow[maxn][maxn];12 int s,t;13 int n,m;14 int num[30];15 int ansf;16 17 void EK(){18 ansf = 0;19 memset(flow,0,sizeof(flow));2... 阅读全文
posted @ 2013-05-29 22:31 等待最好的两个人 阅读(201) 评论(0) 推荐(0)
摘要:基本规律:规律1. 如果几个结点的流量的来源完全相同,则可以把它们合并成一个。规律2. 如果几个结点的流量的去向完全相同,则可以把它们合并成一个。规律3. 如果从点u到点v有一条容量为∞的边,并且点v除了点u以外没有别的流量来源,则可以把这两个结点合并成一个。#include<iostream>#include<cstdio>#include<cstring>#include<queue>#include<algorithm>using namespace std;const int maxn = 205;const int INF 阅读全文
posted @ 2013-05-28 14:00 等待最好的两个人 阅读(135) 评论(0) 推荐(0)
摘要:刘汝佳说这是一道最短路,可是我怎么也想不出如何建图,把问题转换为最短路问题,我就想自己的办法。感觉这个题可以用三维dp;每一维代表一个瓶子 f[maxn][maxn][maxn];状态转移我就想:每一次倒水一定要把一个倒完或把另一个装满才有意义,因为只有这样三个瓶的水量才知道;所以可以根据这个进行状态转移。状态转移代码有点啰嗦,主要是不同维不能统一一个式子。最后想到用队列来存变化的状态。 1 #include <cstdio> 2 #include <cmath> 3 #include <algorithm> 4 #include <iostream& 阅读全文
posted @ 2013-05-25 19:16 等待最好的两个人 阅读(337) 评论(0) 推荐(0)
摘要:由于是背包问题,但直接用dp, 不满足dp中的无后效性,所以用排序来改变顺序;#include <cstdio>#include <cmath>#include <algorithm>#include <iostream>#include <queue>#include <cstdlib>#include <cstring>#define maxn 3005using namespace std;const int INF = 0x3f3f3f;int dp[10005];int ans = 0;struct 阅读全文
posted @ 2013-05-25 10:17 等待最好的两个人 阅读(175) 评论(0) 推荐(0)
摘要:#include<iostream>#include<cstring>#include<cstdio>#include<algorithm>#include<cstdlib>using namespace std;const int maxn = 100010;int n;struct node{ int w,s;}floor[maxn];int cmp(node a,node b){ return a.w-b.s < b.w - a.s; }int main(){ //if(freopen("input.txt&qu 阅读全文
posted @ 2013-05-23 21:19 等待最好的两个人 阅读(163) 评论(0) 推荐(0)
摘要:轮换不等式性质: 1.可比性.2.传递性 1 #include<iostream> 2 #include<cstring> 3 #include<cstdio> 4 #include<cstdlib> 5 #include<algorithm> 6 using namespace std; 7 8 const int maxn = 10005; 9 struct emeny{10 int hp,apk;11 double ave;12 int time;1... 阅读全文
posted @ 2013-05-23 19:17 等待最好的两个人 阅读(190) 评论(0) 推荐(0)
摘要:只能说我被一个小错搞得好心痛,本一写好代码感觉写的还优美,但一个小的不能再小的 i 写出u ,害的我正正调了一天。还不的不与别人对比看。OMG!!具体的分析找别人的吧,说的比我好,要吃个苹果放松下#include <cstdio>#include <cmath>#include <algorithm>#include <iostream>#include <queue>#define maxn 1005using namespace std;const int INF = 0x3f3f3f;double mid;struct Edge 阅读全文
posted @ 2013-05-23 18:07 等待最好的两个人 阅读(147) 评论(0) 推荐(0)
摘要:好蛋疼啊,由于double 不能用memset,害的我调了一个多小时才发现。由于用二分搜索,时间有点大#include #include #include #include #define maxn 1005using namespace std;const int INF = 0x3f3f3f;struct node{ int x,y,z;}Node[maxn];double d[maxn];double G[maxn][maxn];double cost[maxn][maxn];double benefit[maxn][maxn]; int n;double mid,ans;void c. 阅读全文
posted @ 2013-05-22 18:09 等待最好的两个人 阅读(171) 评论(0) 推荐(0)
摘要:本题最主要的就是拆点G[maxn][maxn],前面的是原来的点u,后面的是相对的u',如果接完客人u可以再去接客人v,则连G[u][v] = true; 然后就KM下,用n-m(匹配数)就是答案;#include#include#include#includeusing namespace std;const int maxn = 505;int n,T,ans;struct guest{ int sx,sy; int tx,ty; int st; int time;}gu[maxn];bool G[maxn][maxn];int link[maxn];int vis[maxn];b 阅读全文
posted @ 2013-05-21 19:53 等待最好的两个人 阅读(147) 评论(0) 推荐(0)
摘要:本题本是模板题,但由于开始并查集写出,好不容易发现了,有没改彻底,导致狂WA,以后一定要注意,修改后要多检查,别急忙交;#include #include #include #include #define maxn 105using namespace std;const int INF = 0x3f3f3f;int G[maxn][maxn];struct Edge{ int from; int to; int len; bool operator >N){ memset(G,0,sizeof(G)); Slover.init(N); ... 阅读全文
posted @ 2013-05-21 18:39 等待最好的两个人 阅读(183) 评论(0) 推荐(0)
摘要:#include#include#include#includeusing namespace std;const int maxn = 1005;struct node{ double a,b,c;}Node[maxn];//double a[maxn],b[maxn],c[maxn],d[maxn];int m,n,k;double mid;int cmp(const void *i,const void *j){ return (*(struct node *)i).c >n>>k && n){ m = n - k; for(int i=0;i... 阅读全文
posted @ 2013-05-20 19:05 等待最好的两个人 阅读(258) 评论(0) 推荐(0)
摘要:#include#include#include#includeusing namespace std;const int maxn = 505;struct student{ int height; char gender; char m[105]; char s[105];}stu[maxn];bool G[maxn][maxn];int n,ans;int link[maxn];int vis[maxn];void init(){ memset(link,-1,sizeof(link)); memset(G,0,sizeof(G));}bool dfs... 阅读全文
posted @ 2013-05-20 16:44 等待最好的两个人 阅读(188) 评论(0) 推荐(0)
摘要:#include#include#include#includeusing namespace std;const int maxn = 1005;double a[maxn],b[maxn],c[maxn];int m,n,k;double L,R,mid;bool big(double p){ for(int i=0;in-1-m;i--) sum += c[i]; if(sum >= 0) return true; else return false;}int main(){ //if(freopen("input.txt","r",stdi 阅读全文
posted @ 2013-05-20 16:43 等待最好的两个人 阅读(206) 评论(0) 推荐(0)