码迷,mamicode.com
首页 >  
搜索关键字:zoj bfs    ( 8652个结果
zoj 3557 How Many Sets II
How Many Sets IITime Limit:2 Seconds Memory Limit:65536 KBGiven a setS= {1, 2, ...,n}, numbermandp, your job is to count how many setTsatisfies the fo...
分类:其他好文   时间:2014-05-12 13:05:52    阅读次数:238
ZOJ - 1880 Tug of War
题意:求在两边人数不相差超过1个的情况下,实力尽量相等的情况 思路:从实力和的一半开始类背包操作 #include #include #include #include using namespace std; const int MAXN = 45010; const int MAXM = 110; int a[MAXM]; int dp[MAXN][MAXM]; int n; ...
分类:其他好文   时间:2014-05-11 05:02:03    阅读次数:279
Pat(Advanced Level)Practice--1076(Forwards on Weibo)
Pat1076代码 题目描述: Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed with foll...
分类:其他好文   时间:2014-05-10 04:50:24    阅读次数:403
zoj 1648 Circuit Board
题目:意思就是判断给定的几条线段是否有相交的。 方法:模版吧,有空在来细细学习。 代码: #include #include using namespace std; struct Point { double x,y; }; struct LineSeg { Point a,b; }; double Cross(Point a, Point b, Poi...
分类:其他好文   时间:2014-05-10 03:39:07    阅读次数:326
[容斥原理] zoj 3556 How Many Sets I
题目链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4535 How Many Sets I Time Limit: 2 Seconds      Memory Limit: 65536 KB Give a set S, |S| = n, then how many ordered set g...
分类:其他好文   时间:2014-05-09 13:50:00    阅读次数:347
图的广度优先搜索(BFS)
图的遍历主要有两种方法,第一种是之前博文中介绍过的“图的深度优先遍历”,简称DFS;另一种就是图的广度优先遍历(BFS),在本文中将进行简要探讨。 BFS要做的事,从给定点出发,遍历的一次探寻到所有顶点。其基本思路很容易理解,在此我们利用队列q来存储访问的顶点,用visited[]数组(初始化所有值...
分类:其他好文   时间:2014-05-09 10:06:35    阅读次数:337
NYOJ_58最少步数(queue+BFS)
经典迷宫问题。。。STL~queue+BFS实现,给正在学习使用queue和BFS的童鞋提供一个比较好理解的模板~=w=~...
分类:其他好文   时间:2014-05-09 06:05:13    阅读次数:353
poj 1915 BFS
1 /* 2 题意:国际象棋起点到终点移动的最少步数 3 4 题解:水题,BFS就过了,有人用双向BFS 5 */ 6 #include 7 #include 8 #include 9 10 using namespace std;11 12 int dir[8][2]={-2,1,-1,...
分类:其他好文   时间:2014-05-09 05:34:20    阅读次数:387
2014省赛大总结(一) DFS 与 BFS
第一部分:DFS         DFS(深度优先搜索),深度优先搜索法与回溯法差不多,主要的区别是回溯法在求解过程中不保留完整的树结构,而深度优先搜索则记下完整的搜索树,搜索树起记录解路径和状态判重的作用。为了减少存储空间,在深度优先搜索中,用标志的方法记录访问过的状态,这种处理方法使得深度优先搜索法与回溯法没什么区别了。         深度优先搜索所遵循的搜索策略是尽可能“深”地搜索图。...
分类:其他好文   时间:2014-05-09 01:49:49    阅读次数:304
zoj1444 Final Standings解题报告
想不到学ACM这么久,我还是通过这个题目才了解到ACM比赛中的具体成绩规则!!!!...
分类:其他好文   时间:2014-05-09 01:36:55    阅读次数:225
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!