Problem Description
Now an emergent task for you is to open a password lock. The password is consisted of four digits. Each digit is numbered from 1 to 9.
Each time, you can add or minus 1 to any ...
分类:
其他好文 时间:
2014-08-13 14:57:36
阅读次数:
226
bfs基础算法水题
#include
#include
#include
#include
#include
#include
#include
using namespace std;
const int Max = 1e5+50;
int dist[Max];
vector tree[Max];
int N, D, T;
void init()
{
for(int i = 0; ...
分类:
其他好文 时间:
2014-08-13 14:56:06
阅读次数:
187
Problem Description
可怜的公主在一次次被魔王掳走一次次被骑士们救回来之后,而今,不幸的她再一次面临生命的考验。魔王已经发出消息说将在T时刻吃掉公主,因为他听信谣言说吃公主的肉也能长生不老。年迈的国王正是心急如焚,告招天下勇士来拯救公主。不过公主早已习以为常,她深信智勇的骑士LJ肯定能将她救出。
现据密探所报,公主被关在一个两层的迷宫里,迷宫的入口是S(0,0,0),公主的位...
分类:
其他好文 时间:
2014-08-13 13:12:36
阅读次数:
195
Problem Description
Jerboas are small desert-living animals, which resemble mice with a long tufted tail and very long hind legs. Jerboas shelter in well-hidden burrows. They create two types o...
分类:
其他好文 时间:
2014-08-13 10:33:25
阅读次数:
259
~~~~
题意: 给你一个R*C的图,求其由图中连通‘#“所组成的矩形的个数。
注意:If the ships
were placed correctly (i.e., there are only rectangles that do not touch each other even with a corner), print the sentence "There are S shi...
分类:
其他好文 时间:
2014-08-13 01:16:24
阅读次数:
242
Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.思路:使用BFS遍历无向图。使用map记录原始节点和新节点的地址映射,使用set记录已经完成复制操作的节点地址...
分类:
其他好文 时间:
2014-08-13 00:52:24
阅读次数:
219
Rescue
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 16314 Accepted Submission(s): 5926
Problem Description
Angel was caught b...
分类:
其他好文 时间:
2014-08-12 22:07:24
阅读次数:
317
题意大概就是八数码问题,只不过把空格的移动方式改变了:空格能够向前或向后移动一格或三格(循环的)。分析:其实跟八数码问题差不多,用康托展开记录状态,bfs即可。代码:#include #include #include #include #include #include #include #inc...
分类:
其他好文 时间:
2014-08-12 21:28:14
阅读次数:
236
1 //Accepted 468 KB 812 ms 2 //bfs+dp 3 #include 4 #include 5 #include 6 using namespace std; 7 #include 8 const int imax_n = 105; 9 int ma...
分类:
其他好文 时间:
2014-08-12 18:36:54
阅读次数:
182