题目链接:http://61.187.179.132/JudgeOnline/problem.php?id=1294题意:思路:f[i][j][st]表示从(i,j)出 发到(i,j)停止组成的回路、状态为st的最小步数。从每个0的位置(i,j)进行BFS一次,得到所有的状态。判断一个路径是否包含某...
分类:
其他好文 时间:
2014-06-23 07:51:05
阅读次数:
241
题目链接:http://61.187.179.132/JudgeOnline/problem.php?id=1486题意:给出一个有向图,边有权值。找到一个环,使得环上边的权值之和除以环上边的个数最小。思路:二分答案x,每条边权值减去x,之后 找负环。从每个顶点开始DFS,记录到达某个顶点的距离,设...
分类:
其他好文 时间:
2014-06-23 07:12:27
阅读次数:
236
3D dungeon
时间限制:1000 ms | 内存限制:65535 KB
难度:2
描述You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not
be fil...
分类:
其他好文 时间:
2014-06-22 22:13:18
阅读次数:
223
深度优先算法
问题
给定一个有向图,判断其顶点能否到达另外一个顶点。
解决办法
使用深度优先算法,和无向图中的是一样的。
代码
import java.util.Stack;
/**
* Created by caipeichao on 14-6-11.
*/
public class Digrap...
分类:
其他好文 时间:
2014-06-22 21:32:28
阅读次数:
250
spiral grid
时间限制:2000 ms | 内存限制:65535 KB
难度:4
描述Xiaod has recently discovered the grid named "spiral grid".
Construct the grid like the following figure. (The grid is actually infinite...
分类:
其他好文 时间:
2014-06-22 20:54:07
阅读次数:
185
迷宫寻宝(一)
时间限制:1000 ms | 内存限制:65535 KB
难度:4
描述
一个叫ACM的寻宝者找到了一个藏宝图,它根据藏宝图找到了一个迷宫,这是一个很特别的迷宫,迷宫里有N个编过号的门(N
输入输入可能会有多组测试数据(不超过10组)。
每组测试数据的第一行包含了两个整数M,N(1
.表示可以走的路
S:表示ACM的出发...
分类:
其他好文 时间:
2014-06-22 20:35:19
阅读次数:
295
在一个软件工程项目中,有些任务需要在另外一个任务完成之后才能完成,这种任务在软件工程中是非常常见的。下图就展示了一个软件项目的依赖情况。
这张图非常明显,就是一张有向图。那么,现在问题就来了,如何输出任务的完成顺序呢?
这个问题有一个前提条件,就是有向图中不能出现回路。
算法的基本思想就是在每次dfs返回时将顶点加入到返回结...
分类:
其他好文 时间:
2014-06-22 20:03:38
阅读次数:
221
The partial sum problem
时间限制:1000 ms | 内存限制:65535 KB
难度:2
描述One day,Tom’s girlfriend give him an array A which contains N integers and asked him:Can you choose some integers from the N ...
分类:
其他好文 时间:
2014-06-22 18:00:48
阅读次数:
166
题目如下:
Oil Deposits
The GeoSurvComp geologic survey company is responsible for detectingunderground oil deposits. GeoSurvComp works with one large rectangularregion of land a...
分类:
其他好文 时间:
2014-06-22 14:36:31
阅读次数:
232
blockhouses
时间限制:1000 ms | 内存限制:65535 KB
难度:3
描述Suppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each representing ...
分类:
其他好文 时间:
2014-06-21 22:36:56
阅读次数:
316