摘要: 贪心基础题。至少能赢多少次。换句话说,就是自己每次出一张牌,其他人尽量让你输,其他人足够聪明,当你出一张牌时,为了让你输,会出一张比你大的,除非其他人没有,那么这轮你就赢啦,为了不造成浪费,最优的方法肯定是出一张比你出的牌大的牌中最小的牌(贪心的思想),可以证明这样的贪心结构是正确的#include <iostream> #include <cstdio> #include <algorithm> using namespace std; const int maxn=1001; int vis[maxn],a[maxn]; int n,m; int mai 阅读全文
posted @ 2012-11-27 17:29 LJ_COME!!!!! 阅读(131) 评论(0) 推荐(0)
摘要: 网络流最基础的题目,最大流#include <iostream> #include <cstring> #include <queue> using namespace std; const int maxn=210; const int inf=1<<30; int cap[maxn][maxn],flow[maxn][maxn],d[maxn]; int n,m,tot; void ek() { int q[maxn],p[maxn],i; int front,rear; for(;;) { memset(d,0,sizeof(d)); fr 阅读全文
posted @ 2012-11-27 15:25 LJ_COME!!!!! 阅读(104) 评论(0) 推荐(0)