算法竞赛-第六章
文章平均质量分 90
JeraKrs
本人目前就职于百度商业研发部,有需要内推的朋友简历可发我邮箱 jerakrs@qq.com
展开
-
uva 10305 Ordering Tasks(拓扑排序)
Ordering TasksInput: standard inputOutput: standard outputTime Limit: 1 secondMemory Limit: 32 MB John has n tasks to do. Unfortunately, the tasks are not independent and the execution of原创 2013-08-01 00:11:11 · 3014 阅读 · 0 评论 -
uva 327 Evaluating Simple C Expressions(遍历)
Evaluating Simple C Expressions The task in this problem is to evaluate a sequence of simple C expressions, buy you need not know C to solve the problem! Each of the expressions will a原创 2013-07-31 18:22:51 · 26192 阅读 · 0 评论 -
uva 705 Slash Maze(几何转换+DFS)
Slash Maze By filling a rectangle with slashes (/) and backslashes ( ), you can generate nice little mazes. Here is an example:As you can see, paths in the maze cannot bran原创 2013-08-01 20:49:23 · 1560 阅读 · 0 评论 -
uva 532 Dungeon Master(BFS)
Dungeon Master 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 filled with rock. It takes one minut原创 2013-08-01 00:10:07 · 1170 阅读 · 0 评论 -
uva 127 ``Accordian'' Patience(栈+模拟)
``Accordian'' Patience You are to simulate the playing of games of ``Accordian'' patience, the rules for which are as follows:Deal cards one by one in a row from left to right, n原创 2013-07-07 10:16:55 · 1633 阅读 · 0 评论 -
uva 10152 ShellSort
The ProblemKing Yertle wishes to rearrange his turtle throne to place his highest-ranking nobles and closest advisors nearer to the top. A single operation is available to change the order of th原创 2013-07-16 11:32:35 · 1200 阅读 · 0 评论 -
uva 712 S-Trees(利用二叉树的特点)
S-Trees A Strange Tree (S-tree) over the variable set is a binary tree representing a Boolean function. Each path of the S-tree begins at the root node and consists of n+1 nodes. Ea原创 2013-08-01 00:08:21 · 1643 阅读 · 0 评论 -
uva 699 The Falling Leaves(建树)
The Falling Leaves Each year, fall in the North region is accompanied by the brilliant colors of the leaves on the trees, followed quickly by the falling leaves accumulating under the tr原创 2013-07-07 14:04:32 · 1082 阅读 · 0 评论 -
uva 657 The die is cast(DFS遍历图)
The die is cast InterGames is a high-tech startup company that specializes in developing technology that allows users to play games over the Internet. A market analysis has alerted the原创 2013-08-01 00:09:16 · 1385 阅读 · 0 评论 -
uva 10557 XYZZY(DFS+BFS)
XYZZYADVENT: /ad�vent/, n.The prototypical computer adventure game, first designed by Will Crowther on the PDP-10 in the mid-1970s as an attempt at computer-refereed fantasy gaming, and expande原创 2013-08-01 20:43:45 · 1897 阅读 · 0 评论 -
uva 10004 Bicoloring(并查集)
Bicoloring In 1976 the ``Four Color Map Theorem" was proven with the assistance of a computer. This theorem states that every map can be colored using only four colors, in such a way tha原创 2013-08-01 00:10:20 · 1525 阅读 · 0 评论 -
uva 442 Matrix Chain Multiplication(模拟)
Matrix Chain Multiplication Suppose you have to evaluate an expression like A*B*C*D*E where A,B,C,D and E are matrices. Since matrix multiplication is associative, the order in which mul原创 2013-07-07 09:42:14 · 1368 阅读 · 0 评论 -
uva 540 Team Queue(队列+模拟)
Team Queue Queues and Priority Queues are data structures which are known to most computer scientists. The Team Queue, however, is not so well known, though it occurs often in everyday原创 2013-07-19 15:26:32 · 1357 阅读 · 0 评论 -
uva 548 tree(中序后序还原树)
Tree You are to determine the value of the leaf node in a given binary tree that is the terminal node of a path of least value from the root of the binary tree to any leaf. The value o原创 2013-07-16 12:52:03 · 2195 阅读 · 0 评论 -
uva 10054 The Necklace(欧拉回路)
The Necklace My little sister had a beautiful necklace made of colorful beads. Two successive beads in the necklace shared a common color at their meeting point. The figure below shows原创 2013-08-01 00:10:38 · 2609 阅读 · 0 评论 -
uva 10050 Hartals(枚举)
Problem D: Hartals A social research organization has determined a simple set of parameters to simulate the behavior of the political parties of our country. One of the parameters is a p原创 2013-07-19 20:30:02 · 1118 阅读 · 0 评论 -
uva 133 The Dole Queue(模拟)
#include#includeusing namespace std;#define N 25int num[N];int main(){ int n,lift,right; int i; while(cin>>n>>lift>>right,n||lift||right) { //Init. int cnt=n; int now_lift=1,now_righ原创 2013-07-07 17:22:17 · 1445 阅读 · 1 评论 -
uva 196 Spreadsheet(拓扑排序+DFS)
Spreadsheet In 1979, Dan Bricklin and Bob Frankston wrote VisiCalc, the first spreadsheet application. It became a huge success and, at that time, was the killer application for the Ap原创 2013-08-01 20:30:16 · 2142 阅读 · 0 评论 -
uva 10562 Undraw the Trees(数据处理+建树)
Undraw the Trees Input: Standard InputOutput: Standard OutputTime Limit: 2 Seconds Professor Homer has been reported missing. We suspect that his recent research works might have had somethi原创 2013-08-01 00:08:59 · 1224 阅读 · 0 评论 -
uva 10129 Play on Words(欧拉道路)
Play on WordsSome of the secret doors contain a very interesting word puzzle. The team of archaeologists has to solve it to open that doors. Because there is no other way to open the doors, the pu原创 2013-08-01 00:05:12 · 1410 阅读 · 0 评论 -
uva 10596 Morning Walk(欧拉回路)
Kamal is a Motashota guy. He has got a new job in Chittagong. So, he has moved to Chittagong from Dinajpur. He was getting fatter in Dinajpur as he had no work in his hand there. So, moving to Chittag原创 2013-08-01 00:10:52 · 1269 阅读 · 0 评论 -
uva 101 The Blocks Problem(模拟)
The Blocks Problem Background Many areas of Computer Science use simple, abstract domains for both analytical and empirical studies. For example, an early AI study of planning原创 2013-07-16 18:29:14 · 1454 阅读 · 0 评论 -
uva 673 Parentheses Balance(栈)
You are given a string consisting of parentheses () and []. A string of this type is said to be correct:(a)if it is the empty string(b)if A and B are correct, AB is correct,(c)if A is correct, (A)原创 2013-07-17 00:26:20 · 1373 阅读 · 0 评论 -
uva 11234 Expressions(后缀变层次)
ExpressionsArithmetic expressions are usually written with the operators in between the two operands (which is called infix notation). For example, (x+y)*(z-w) is an arithmetic expression in inf原创 2013-07-18 15:13:07 · 1186 阅读 · 0 评论 -
uva 839 Not so Mobile(抽象意义上的建树)
Not so Mobile Before being an ubiquous communications gadget, a mobile was just a structure made of strings and wires suspending colourfull things. This kind of mobile is usually found原创 2013-07-31 18:52:35 · 1433 阅读 · 0 评论 -
uva 784 Maze Exploration(DFS遍历图)
Maze Exploration A maze of rectangular rooms is represented on a two dimensional grid as illustrated in figure 1a. Each point of the grid is represented by a character. The points of r原创 2013-08-01 00:06:16 · 1347 阅读 · 0 评论 -
uva 439 Knight Moves(BFS)
Knight Moves A friend of you is doing research on the Traveling Knight Problem (TKP) where you are to find the shortest closed tour of knight moves that visits each square of a given s原创 2013-07-17 19:16:17 · 1247 阅读 · 0 评论 -
uva 11111 Generalized Matrioshkas(栈)
Problem B - Generalized Matrioshkas Vladimir worked for years making matrioshkas, those nesting dolls that certainly represent truly Russian craft. A matrioshka is a doll that may be opene原创 2013-07-19 19:56:43 · 1283 阅读 · 0 评论 -
uva 112 Tree Summing(建树+遍历)
Tree Summing BackgroundLISP was one of the earliest high-level programming languages and, with FORTRAN, is one of the oldest languages currently being used. Lists, which are th原创 2013-07-31 13:41:04 · 2292 阅读 · 10 评论 -
uva 297 Quadtrees
test#include#include#includeusing namespace std;#define N 10000int sum;char *move;void build(int n);int cut(char *t,int f) // 对 'p' 与 'f' 相遇时,'p'的后续子树进行删除{ for(int i=0;原创 2013-07-07 09:25:44 · 1445 阅读 · 0 评论 -
uva 572 Oil Deposits(DFS遍历图)
Oil Deposits The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and c原创 2013-08-01 00:09:56 · 1618 阅读 · 0 评论 -
uva 10047 The Monocycle(BFS+状态判重)
The Monocycle A monocycle is a cycle that runs on one wheel and the one we will be considering is a bit more special. It has a solid wheel colored with five different colors as shown i原创 2013-08-01 00:08:01 · 1307 阅读 · 0 评论