/*代码一: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#include#include#include#includeusing
namespace std;class node{public: int val; node* left; node* right; node():va...
分类:
其他好文 时间:
2014-05-26 14:49:14
阅读次数:
247
#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
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