InkGenius

Good developers who are familiar with the entire stack know how to make life easier for those around

广度优先搜索(BFS)

广度优先搜索算法(Breadth-First-Search),又译作宽度优先搜索,或横向优先搜索,简称BFS,是一种图形搜索算法。简单的说,BFS是从根节点开始,沿着树的宽度遍历树的节点。如果所有节点均被访问,则算法中止。 原理:从算法的观点,所有因为展开节点而得到的子节点都会被加进一个先进先出...

2013-07-31 23:46:16

阅读数:660

评论数:0

POJ 1503 Integer Inquiry(大数相加)

一、Description One of the first users of BIT's new supercomputer was Chip Diller. He extended his exploration of powers of 3 to go from 0 to 333 and ...

2013-07-31 22:19:56

阅读数:510

评论数:0

Poj1062 昂贵的聘礼 (dijkstra算法)

一、Description 年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给他。探险家拿不出这么多金币,便请求酋长降低要求。酋长说:"嗯,如果你能够替我弄到大祭司的皮袄,我可以只要8000金币。如果你...

2013-07-30 20:00:29

阅读数:593

评论数:0

Poj 1067 取石子游戏(NIM,威佐夫博奕)

一、Description 有两堆石子,数量任意,可以不同。游戏开始由两个人轮流取石子。游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子;二是可以在两堆中同时取走相同数量的石子。最后把石子全部取完者为胜者。现在给出初始的两堆石子的数目,如果轮到你先取,假设双方都采取最好的策...

2013-07-28 15:19:59

阅读数:683

评论数:0

Poj 2853,2140 Sequence Sum Possibilities(因式分解)

一、Description Most positive integers may be written as a sum of a sequence of at least two consecutive positive integers. For instance, 6 = 1 + 2...

2013-07-27 17:14:20

阅读数:770

评论数:0

poj 1519 Digital Roots (计算根数字)

一、Description The digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then tha...

2013-07-27 17:03:20

阅读数:613

评论数:0

Poj 2503 Babelfish(Map操作)

一、Description You have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately,...

2013-07-25 23:21:39

阅读数:492

评论数:0

Poj 1936,3302 Subsequence(LCS)

一、Description(3302) Given a string s of length n, a subsequence of it, is defined as another string s' = su1su2...sum where 1 ≤ u1 u2 um ≤ n a...

2013-07-25 22:45:44

阅读数:604

评论数:0

LCS(最长公共子序列问题)

LCS(Longest Common Subsequence),即最长公共子序列。一个序列,如果是两个或多个已知序列的子序列,且是所有子序列中最长的,则为最长公共子序列。 原理:              事实上,最长公共子序列问题也有最优子结构性质。然后,用动态规划的方法找到状态转...

2013-07-25 22:40:12

阅读数:583

评论数:0

Poj 1125 Stockbroker Grapevine(Floyd算法求结点对的最短路径问题)

一、Description Stockbrokers are known to overreact to rumours. You have been contracted to develop a method of spreading disinformation amongst the s...

2013-07-25 18:06:29

阅读数:609

评论数:0

Floyd-Warshall算法:求结点对的最短路径问题

Floyd-Warshall算法:是解决任意两点间的最短路径的一种算法,可以正确处理有向图或负权的最短路径问题,同时也被用于计算有向图的传递闭包。 原理: Floyd-Warshall算法的原理是动态规划(DP)。 设D_{i,j,k}为从i到j的只以(1..k)集合中的节点为中间节点的最短路...

2013-07-25 17:46:35

阅读数:954

评论数:0

poj 1208 Web Navigation(堆栈操作)

一、Description Standard web browsers contain features to move backward and forward among the pages recently visited. One way to implement these featu...

2013-07-24 11:00:13

阅读数:701

评论数:0

poj 1273 Drainage Ditches(最大流,E-K算法)

一、Description Every time it rains on Farmer John's fields, a pond forms over Bessie's favorite clover patch. This means that the clover is covered b...

2013-07-23 19:16:19

阅读数:662

评论数:0

Poj 1458 Common Subsequence(LCS)

一、Description A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = another seq...

2013-07-23 10:47:18

阅读数:451

评论数:0

Poj 1552 Doubles(水题)

一、Description As part of an arithmetic competency program, your students will be given randomly generated lists of from 2 to 15 unique positive inte...

2013-07-22 19:00:20

阅读数:506

评论数:0

poj 2105 IP Address(水题)

一、Description Suppose you are reading byte streams from any device, representing IP addresses. Your task is to convert a 32 characters long sequence...

2013-07-22 17:58:34

阅读数:505

评论数:0

poj 1517 u Calculate e(精度控制+水题)

一、Description A simple mathematical formula for e is e=Σ01/i! where n is allowed to go to infinity. This can actually yield very accurate appro...

2013-07-22 17:05:57

阅读数:465

评论数:0

poj 1658 Eva's Problem(水题)

一、Description Eva的家庭作业里有很多数列填空练习。填空练习的要求是:已知数列的前四项,填出第五项。因为已经知道这些数列只可能是等差或等比数列,她决定写一个程序来完成这些练习。 Input 第一行是数列的数目t(0 Output 对输入的每个数列,输出它的前五项。 二、...

2013-07-22 16:27:08

阅读数:556

评论数:0

Poj 2017 Speed Limit(水题)

一、Description Bill and Ted are taking a road trip. But the odometer in their car is broken, so they don't know how many miles they have driven. Fort...

2013-07-22 16:05:24

阅读数:562

评论数:0

Poj 1316 Self Numbers(水题)

一、Description In 1949 the Indian mathematician D.R. Kaprekar discovered a class of numbers called self-numbers. For any positive integer n, define d...

2013-07-22 11:34:39

阅读数:460

评论数:0

提示
确定要删除当前文章?
取消 删除
关闭
关闭