上一页 1 ··· 5 6 7 8 9 10 11 12 下一页
摘要: (~ ̄▽ ̄)~* #include #include #include using namespace std; const int MAXN=100005; char s[MAXN]; int main() { int n; scanf("%d",&n); scanf("%s",s);//输入01串 int origin=1,flip=0; for(i... 阅读全文
posted @ 2016-02-25 12:00 &ATM 阅读(110) 评论(0) 推荐(0) 编辑
摘要: (~ ̄▽ ̄)~* //求一个集合,这个集合与任意一个区间的交集,需至少有两个数字 //贪心过程:按n个区间的最右值从小到大对区间进行排列, //集合首先取第一个区间的最右两个数字, //到第二个区间,判断集合里的数有没有在区间里 //没有的话,就从第二个区间的最右开始往左取(cnt=0取最后两个数,cnt=1取最后一个数) #include #include #include #include #... 阅读全文
posted @ 2016-02-25 11:35 &ATM 阅读(135) 评论(0) 推荐(0) 编辑
摘要: (~ ̄▽ ̄)~* //既然是求最少能胜几次 //说明对方是要尽可能让我输 //但为了避免浪费,对方会用比我的牌大的牌中的最小pip的牌来击败我 #include #include #include #include using namespace std; int main() { int Cas=0; int m,n,pip[1010],vis[1010]; while... 阅读全文
posted @ 2016-02-25 11:34 &ATM 阅读(155) 评论(0) 推荐(0) 编辑
摘要: (~ ̄▽ ̄)~* (注意下面代码中关于iterator的用法,此代码借鉴某大牛) #include #include #include #include using namespace std; struct Wall { int row;//表示墙在哪行 int left; int right; }; int col[105];//保存每列的墙数 vector wal... 阅读全文
posted @ 2016-02-23 17:44 &ATM 阅读(352) 评论(0) 推荐(0) 编辑
摘要: (~ ̄▽ ̄)~* 这道题用到了cstdlib库的qsort()函数: 用法链接:http://www.cnblogs.com/syxchina/archive/2010/07/29/2197382.html #include #include #include #include #include using namespace std; struct stick { int l,... 阅读全文
posted @ 2016-02-23 17:42 &ATM 阅读(166) 评论(0) 推荐(0) 编辑
摘要: (~ ̄▽ ̄)~* #include #include #include using namespace std; const int N=30; int n,h,H;//H:记录原本有多少小时的时间;h:贪心的时候,防止H被修改 int res[N],RES[N];//res[]:贪心的时候保存结果;RES[]:用于记录最终结果 int maxn,sum;//maxn:保存最终结果,即捕到的鱼最... 阅读全文
posted @ 2016-02-23 17:38 &ATM 阅读(164) 评论(0) 推荐(0) 编辑
摘要: ( ̄▽ ̄)" //无向二分图的最小路径覆盖数=顶点总数-最大匹配数/2(最大匹配数=最小点覆盖数) //这里最大匹配数需要除以2,因为每两个相邻的*连一条边,即和是一样的,所以结果多了一倍 #include #include #include #include #include using namespace std; const int MAXN=405; int uN; char G[MAX... 阅读全文
posted @ 2016-02-19 18:06 &ATM 阅读(141) 评论(0) 推荐(0) 编辑
摘要: ( ̄▽ ̄)" //凡无向图,求匹配时都要除以2 #include #include #include #include #include using namespace std; const int MAXN=1505; int uN; vector g[MAXN]; int link[MAXN]; bool vis[MAXN]; bool DFS(int u) { for(int i... 阅读全文
posted @ 2016-02-19 18:04 &ATM 阅读(323) 评论(0) 推荐(0) 编辑
摘要: ( ̄▽ ̄)" #include #include #include #include #include #include using namespace std; const int MAXN=505; int uN; //二分图左边的点集 vector g[MAXN]; //存储矩阵数据 int link[MAXN]; //记录右边的点v在左边的点集uN中所匹配的点x的编号 bool vis[... 阅读全文
posted @ 2016-02-19 18:02 &ATM 阅读(168) 评论(0) 推荐(0) 编辑
摘要: http://blog.sina.com.cn/s/blog_691ce2b701016reh.html 阅读全文
posted @ 2016-02-19 17:59 &ATM 阅读(204) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 下一页
……