码迷,mamicode.com
首页 >  
搜索关键字:poj bfs    ( 24949个结果
BFS(两个水杯转换水量)
题意:给出两个容积分别为 a 和 b 的pot,按照以下三种操作方式,求出能否在一定步数后,使者两个pot的其中一个的水量为c。1.FILL(i):将ipot倒满水。2.DROP(i):将ipot倒空水。3.POUR(i,j):将ipot的水倒到jpot上,直至要么ipot为空,要么jpot为满。思...
分类:其他好文   时间:2014-05-26 21:29:21    阅读次数:368
poj 2288 Islands and Bridges_状态压缩dp_哈密尔顿回路问题
题目链接题目描写叙述:哈密尔顿路问题。n个点,每个点有权值,设哈密尔顿路为 C1C2...Cn,Ci的权值为Vi,一条哈密尔顿路的值分为三部分计算:1.每个点的权值之和2.对于图中的每一条CiCi+1,加上Vi*Vi+13.对于路径中的连续三个点:CiCi+1Ci+2,若在图中,三点构成三角形,则要...
分类:其他好文   时间:2014-05-26 15:14:18    阅读次数:192
poj 3253 -- Fence Repair
Fence RepairTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 24252Accepted: 7766DescriptionFarmer John wants to repair a small length of the f...
分类:其他好文   时间:2014-05-26 15:12:15    阅读次数:193
zoj3675 BFS+状态压缩
#include #include #include using namespace std;int n;int vis[10000000];int mode1,mode2;struct node{ int step,status;};void print(int x){ int tmp...
分类:其他好文   时间:2014-05-26 13:50:43    阅读次数:262
poj-3264-Balanced Lineup-线段树-区域查询
区域查询操作。 ma[i]:i区间内的最大值 mi[i]:i区间内的最小值 #include #include #include #include #include using namespace std; #define INF 99999999 #define lmin 1 #define rmax n #define lson l,(l+r)/2,rt<<1 #define rson ...
分类:其他好文   时间:2014-05-26 04:11:41    阅读次数:202
建图方式一 之 “邻接链表”
唉o(︶︿︶)o ,我果然还是玩不了 邻接链表,捣鼓了一晚上,只实现了 DFS的搜索 ,BFS 至今还不会,快回宿舍了,等校赛后再研究吧 邻接链表:                 n个顶点m条边的无向图,表示中有 n 个顶点表结点和 2m 个边表结点。(也就是说,每条边 u-v 在邻接表 中出现两次:一次在关于u的邻接表中,另一次在关于v的邻接表中)PS:注意是无向图,有...
分类:其他好文   时间:2014-05-24 23:30:32    阅读次数:247
[Wikioi 1226]倒水问题
题目描述 Description 有两个无刻度标志的水壶,分别可装 x 升和 y 升 ( x,y 为整数且均不大于 100 )的水。设另有一水 缸,可用来向水壶灌水或接从水壶中倒出的水, 两水壶间,水也可以相互倾倒。已知 x 升壶为空 壶, y 升壶为空壶。问如何通过倒水或灌水操作, 用最少步数能在x或y升的壶中量出 z ( z ≤ 100 )升的水 来。 输入描述 Inpu...
分类:其他好文   时间:2014-05-24 21:47:25    阅读次数:275
poj 3031 Big Christmas Tree(水spfa)
http://poj.org/problem?id=3013 题意: Because of a technical difficulty, price of an edge will be (sum of weights of all descendant nodes) × (unit price of the edge).这句话一直没看懂。后面还以为是最小生成树。 正确...
分类:其他好文   时间:2014-05-24 20:27:13    阅读次数:266
POJ 3164 Command Network 最小树形图-朱刘算法裸题
题目来源:POJ 3164 Command Network 题意:求以1为根的最小树形图 没有输出字符串 思路:直接高朱刘算法 不懂的可以百度 学会了就是直接套模板的事情 其实就是不断消圈而已 不构成圈就有解 无法从根到达其他点就无解   #include #include #include const int maxn = 110; const int maxm = 500...
分类:Web程序   时间:2014-05-24 19:34:36    阅读次数:325
poj 1068 -- Parencodings
ParencodingsTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 19068Accepted: 11503DescriptionLet S = s1 s2...s2n be a well-formed string of par...
分类:其他好文   时间:2014-05-24 09:16:54    阅读次数:191
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!