上一页 1 ··· 4 5 6 7 8 9 下一页
摘要: 题目链接题目意思:输入n,接下来为n行n列,X表示墙不能放置碉堡而且碉堡打不透,同行同列不能放两个碉堡(有x阻挡的除外)问:最多可以建立多少个碉堡。#include #include #include #include using namespace std;char str[20][20];str... 阅读全文
posted @ 2015-08-10 10:20 梦中。。 阅读(124) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include using namespace std;const int maxn=333;const int oo=0x3f3f3f3f;int maps[maxn][maxn],lx[maxn],ly[maxn];int visx[max... 阅读全文
posted @ 2015-08-08 19:48 梦中。。 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 邻接表这种高科技的小儿科,你会就是小儿科 ,不会啦就是高科技。 如下图所示输入边为 1 2 1 3 1 4 2 4 3 4 head 0 -1 1 -1 0 1 2 head【i】保存的是与i相连的e数组的下标; 2 -1 3 next保存的是与v相连的那个 和其他相连的下标 若next=-1表示没 阅读全文
posted @ 2015-08-08 16:40 梦中。。 阅读(436) 评论(0) 推荐(1) 编辑
摘要: 首先应该求出来连通分量,进行缩点,然后求每个分量的入度和出度,入度等于0的很明显都需要分发一个文件,至于需要添加几条边可以成为一个强连通,就是出度和入度最大的那个,因为需要把出度和入度相连。#include #include #include #include #include #include #... 阅读全文
posted @ 2015-08-08 08:15 梦中。。 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 时隔一年做了这道历史悠久的题目,之前不知道是什么原因写到一半不写了,这次再看这道题,有了些思路,其实并不难,只是要把那些条件分开,不可混淆。 线段树区间合并,主要是进行合并。 阅读全文
posted @ 2015-08-08 01:04 梦中。。 阅读(176) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include #include #include #include #include #include using namespace std;#define N 12005#define INF 0xff... 阅读全文
posted @ 2015-08-05 20:28 梦中。。 阅读(173) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std;#define maxn 100005#define lson rt>1; } int len() { return r-l+1; }} a[maxna[rt].Mid()) ... 阅读全文
posted @ 2015-07-31 16:29 梦中。。 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 给你一张图,判断是否只有唯一一个最小生成树。解题思路:先用prim算法找出一棵最小生成树,那么在此过程中用max【x】【y】数组来保存x,y两点之间唯一路中的最大那条边的权值,然后枚举不在最小生成树里面的边来替换。#include #include #include #include using n... 阅读全文
posted @ 2015-07-26 11:10 梦中。。 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 题目大致意思:第一行输入n,m,表示有共有n个数字,下面会有m行操作。每次输入ai,bi,si表示从ai到bi的和为si,最后输出有m次中有几次和上面的有冲突。!!!!!!sum【x】表示从x的父节点到达x的值#include #include using namespace std;const i... 阅读全文
posted @ 2015-07-25 19:45 梦中。。 阅读(141) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include #include #include #include #include #include using namespace std;void DFS(int k,int n,int m);int... 阅读全文
posted @ 2015-03-11 21:02 梦中。。 阅读(139) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 下一页