上一页 1 ··· 42 43 44 45 46 47 48 49 50 ··· 71 下一页
摘要: 模拟着算写完 挂在第7组上 之后乱七八糟的改。。终于刷完了第二章 刷了好久了。。偶尔想起来刷刷View Code 1 /* 2 ID: shangca2 3 LANG: C++ 4 TASK: fracdec 5 */ 6 #include <iostream> 7 #include<cstdio> 8 #include<cstring> 9 #include<stdlib.h>10 #include<algorithm>11 using namespace std;12 int d,di[100000],v[1000001],g,f 阅读全文
posted @ 2013-04-28 18:36 _雨 阅读(192) 评论(3) 推荐(0) 编辑
摘要: floyd之后 枚举找最小就行 会有重边View Code 1 /* 2 ID: shangca2 3 LANG: C++ 4 TASK: comehome 5 */ 6 #include <iostream> 7 #include<cstdio> 8 #include<cstring> 9 #include<algorithm>10 #include<stdlib.h>11 #define INF 0x3f3f3f12 using namespace std;13 int w[110][110];14 int main()15 {1 阅读全文
posted @ 2013-04-28 10:46 _雨 阅读(166) 评论(0) 推荐(0) 编辑
摘要: dfs用来求这个节点属于哪一块 用floyd求出各点间的最短距离 再求出每个节点可达到的最远距离MAX[i]以及这两个块中的最长距离a,b. 枚举当两个节点不在一块中dis = max{(dis[i][j]+MAX[i]+MAX[j]),a,b),在求出dis中最小的。View Code 1 /* 2 ID: shangca2 3 LANG: C++ 4 TASK: cowtour 5 */ 6 #include <iostream> 7 #include<cstdio> 8 #include<cstring> 9 #include<algorithm 阅读全文
posted @ 2013-04-27 11:59 _雨 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 感觉很巧妙的一道题 之前比赛做过一道题与这个类似 当时没想出来很多蚂蚁在一条线上走 对撞之后改变方向 问T时间之后 蚂蚁分别在哪里 蚂蚁都是一样的 可以把蚂蚁看做一个点 对撞的时候 可以看做穿过 这样T之后哪些点有蚂蚁就知道了 就是不知道这个点的原点是哪个 可以把输入的点排序 因为相对顺序是不变的 就知道这个点原来是哪个了不知道为嘛一直交不对 重新打了一遍 就A了View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<algorithm> 阅读全文
posted @ 2013-04-24 11:54 _雨 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 刚开始想写最短路 没写出来 TLE了在最后一组数据上 加了点优化过了 从两个出口出 像各点BFS 取最小中的最大值View Code 1 /* 2 ID: shangca2 3 LANG: C++ 4 TASK: maze1 5 */ 6 #include <iostream> 7 #include<cstdio> 8 #include<cstring> 9 #include<algorithm> 10 #include<stdlib.h> 11 #include<queue> 12 using namespace std 阅读全文
posted @ 2013-04-18 09:53 _雨 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 刚开始输出0的时候想错了一地方 想着标记来着 看CZ的 数不大 直接大于多少时退出就好了View Code 1 /* 2 ID: cuizhe 3 LANG: C++ 4 TASK: ttwo 5 */ 6 #include <iostream> 7 #include<cstdio> 8 #include<cstring> 9 #include<algorithm> 10 #include<stdlib.h> 11 using namespace std; 12 char str[12][12]; 13 int s1,s2,s3,s4 阅读全文
posted @ 2013-04-17 18:06 _雨 阅读(152) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2942代码敲的迷迷糊糊的 照把书上的给搬上来的给篇讲的不错的解题报告 各种定义都有 http://blog.csdn.net/lyy289065406/article/details/6756821做这题之前 一定要把相关定义搞清楚 割点 双连通分量 二分图 奇圈View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<algorithm> 5 #include<stdlib.h&g 阅读全文
posted @ 2013-04-16 20:34 _雨 阅读(188) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1523参考着各种书籍 网上的讲解 及各种tarjan算法 总算 把它捣鼓出来了这题是求割点 及割点分割出来的块数 模板题 块数利用dfs可加出来http://blog.csdn.net/lyy289065406/article/details/6752662从这偷来一些知识点1、【割点】在一个无向连通图中,如果有一个顶点集合,删除这个顶点集合,以及这个集合中所有顶点相关联的边以后,原图变成多个连通块,就称这个点集为割点集合。当割点集合的顶点个数只有1个时,该顶点就是割点。2、【连通分量】当删除某个割点后,原图会被划分为若干个互不连通的子图, 阅读全文
posted @ 2013-04-15 14:24 _雨 阅读(301) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3422最小费用最大流 求的时候把边加为负的 输出的时候再负回来 就变成求的最大费用了拆点 一个点拆为 i i' i->i'连两条边 一条cap为0 cost为给出的值 另一条cap为INF cost为0,i'到右和下分别设置一条边cap为INF cost为0设置超级源点到1节点 cap为K cost为0View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<alg 阅读全文
posted @ 2013-03-23 15:08 _雨 阅读(304) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2195模板题 超级源点-》men->house->超级汇点 坐标差值为两点的cost值 cap为1View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<algorithm> 5 #include<queue> 6 #include<stdlib.h> 7 #define INF 0xfffffff 8 using namespace std; 9 s 阅读全文
posted @ 2013-03-23 00:46 _雨 阅读(236) 评论(0) 推荐(0) 编辑
上一页 1 ··· 42 43 44 45 46 47 48 49 50 ··· 71 下一页