/*代码一:DFS+Enum*///Memory Time //240K 344MS
//本题只要求输出翻转的次数,因此BFS或DFS都适用#includeusing namespace std;bool
chess[6][6]={false};//利用的只有中心的4x4bool flag;in.....
分类:
其他好文 时间:
2014-05-26 22:45:54
阅读次数:
323
题意:给出两个容积分别为 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
#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
唉o(︶︿︶)o ,我果然还是玩不了 邻接链表,捣鼓了一晚上,只实现了 DFS的搜索 ,BFS 至今还不会,快回宿舍了,等校赛后再研究吧
邻接链表:
n个顶点m条边的无向图,表示中有
n 个顶点表结点和 2m 个边表结点。(也就是说,每条边 u-v 在邻接表 中出现两次:一次在关于u的邻接表中,另一次在关于v的邻接表中)PS:注意是无向图,有...
分类:
其他好文 时间:
2014-05-24 23:30:32
阅读次数:
247
Rescue
Problem Description
Angel was caught by the MOLIGPY! He was put in prison by Moligpy. The prison is described as a N * M (N, M
Angel's friends want to save Angel. Their task is: a...
分类:
其他好文 时间:
2014-05-23 00:06:37
阅读次数:
482
胜利大逃亡
Problem Description
Ignatius被魔王抓走了,有一天魔王出差去了,这可是Ignatius逃亡的好机会.
魔王住在一个城堡里,城堡是一个A*B*C的立方体,可以被表示成A个B*C的矩阵,刚开始Ignatius被关在(0,0,0)的位置,离开城堡的门在(A-1,B-1,C-1)的位置,现在知道魔王将在T分钟后回到城堡,Ignatius每分钟...
分类:
其他好文 时间:
2014-05-22 17:18:20
阅读次数:
333
Visit a tree by level,namely BFS.
分类:
其他好文 时间:
2014-05-22 01:48:48
阅读次数:
310
POJ 3278 Catch That Cow
题目大意:
告诉你起点位置和终点位置,你可以有三种操作,从某个位置x,可以到达x-1,x+1,2*x,问你从起点到终点最短时间?
解题思路:
利用bfs枚举位置即可
但是刨除以下情况,也就是剪枝一下
1、当x终点位置时,x+1和2*x均不能到达
解题代码:见本文详细...
分类:
其他好文 时间:
2014-05-21 14:33:08
阅读次数:
241
请不要随便指点别人该怎么做、每个人的人生都应该自己掌握、你给不了别人一切、你也不懂别人的忧伤、
微笑不代表快乐、哭泣不一定悲伤
不努力怎么让关心你的人幸福、不努力怎么让看不起你的...
分类:
其他好文 时间:
2014-05-21 10:31:31
阅读次数:
202
Catch That Cow
Problem Description
Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number li...
分类:
其他好文 时间:
2014-05-21 07:02:40
阅读次数:
312