HDU 1026 Ignatius and the Princess I(BFS)

摘要: 题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=1026在这博客学的 ttp://www.wutianqi.com/?p=2354感觉看了这个之后收获良多#include <queue>#include <stack>#include <cstdio>#include <iostream>#include <string.h>#include <algorithm>using namespace std;typedef struct node{ int x,y,dis; int 阅读全文
posted @ 2012-03-29 22:46 江财小子 阅读(136) 评论(0) 推荐(0) 编辑

3006 HDU The Number of set

摘要: http://www.cnblogs.com/lonelycatcher/archive/2011/05/27/2060158.htmlGiven you n sets.All positive integers in sets are not less than 1 and not greater than m.If use these sets to combinate the new set,how many different new set you can get.The given sets can not be broken.InputThere are several case 阅读全文
posted @ 2012-03-29 17:06 江财小子 阅读(225) 评论(0) 推荐(0) 编辑

HDU 改革春风吹满地

摘要: “ 改革春风吹满地,不会AC没关系;实在不行回老家,还有一亩三分地。谢谢!(乐队奏乐)”话说部分学生心态极好,每天就知道游戏,这次考试如此简单的题目,也是云里雾里,而且,还竟然来这么几句打油诗。好呀,老师的责任就是帮你解决问题,既然想种田,那就分你一块。这块田位于浙江省温州市苍南县灵溪镇林家铺子村,多边形形状的一块地,原本是linle 的,现在就准备送给你了。不过,任何事情都没有那么简单,你必须首先告诉我这块地到底有多少面积,如果回答正确才能真正得到这块地。发愁了吧?就是要让你知道,种地也是需要AC知识的!以后还是好好练吧...Input输入数据包含多个测试实例,每个测试实例占一行,每行的开始 阅读全文
posted @ 2012-03-28 18:03 江财小子 阅读(617) 评论(0) 推荐(0) 编辑

hdu 1205 吃糖果

摘要: HOHO,终于从Speakless手上赢走了所有的糖果,是Gardon吃糖果时有个特殊的癖好,就是不喜欢将一样的糖果放在一起吃,喜欢先吃一种,下一次吃另一种,这样;可是Gardon不知道是否存在一种吃糖果的顺序使得他能把所有糖果都吃完?请你写个程序帮忙计算一下。Input第一行有一个整数T,接下来T组数据,每组数据占2行,第一行是一个整数N(0<N<=1000000),第二行是N个数,表示N种糖果的数目Mi(0<Mi<=1000000)。Output对于每组数据,输出一行,包含一个"Yes"或者"No"。Sample Input2 阅读全文
posted @ 2012-03-28 17:55 江财小子 阅读(156) 评论(0) 推荐(0) 编辑

HDU 1556 Color the ball

摘要: N个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a <= b),lele便为骑上他的“小飞鸽"牌电动车从气球a开始到气球b依次给每个气球涂一次颜色。但是N次以后lele已经忘记了第I个气球已经涂过几次颜色了,你能帮他算出每个气球被涂过几次颜色吗?Input每个测试实例第一行为一个整数N,(N <= 100000).接下来的N行,每行包括2个整数a b(1 <= a <= b <= N)。当N = 0,输入结束。Output每个测试实例输出一行,包括N个整数,第I个数代表第I个气球总共被涂色的次数。Sample Input 阅读全文
posted @ 2012-03-28 17:54 江财小子 阅读(187) 评论(0) 推荐(0) 编辑

POJ 3067 Japan

摘要: Japan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. Japan is tall island with N cities on the East coast and M cities on the West coast (M <= 1000, N <= 1000). K superhighways will be build. Cities on each coast are numbered 1, 2, ... from North to 阅读全文
posted @ 2012-03-28 17:53 江财小子 阅读(213) 评论(0) 推荐(0) 编辑

hdu 1541 Stars

摘要: Astronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars that are not higher and not to the right of the given star. Astronomers want to know the distribution of the levels of the s 阅读全文
posted @ 2012-03-28 17:52 江财小子 阅读(259) 评论(0) 推荐(0) 编辑

POJ 2255 Tree Recovery

摘要: Little Valentine liked playing with binary trees very much. Her favorite game was constructing randomly looking binary trees with capital letters in the nodes.This is an example of one of her creations:D/ \/ \B E/ \ \/ \ \A C G//FTo record her trees for future generations, she wrote down two strings 阅读全文
posted @ 2012-03-28 17:51 江财小子 阅读(248) 评论(0) 推荐(0) 编辑

HDU(3999)The order of a Tree

摘要: As we know,the shape of a binary search tree is greatly related to the order of keys we insert. To be precisely:1.insert a key k to a empty tree, then the tree become a tree withonly one node;2.insert a key k to a nonempty tree, if k is less than the root ,insertit to the left sub-tree;else insert k 阅读全文
posted @ 2012-03-28 17:50 江财小子 阅读(435) 评论(0) 推荐(0) 编辑

HDU (1710)Binary Tree Traversals

摘要: A binary tree is a finite set of vertices that is either empty or consists of a root r and two disjoint binary trees called the left and right subtrees. There are three most important ways in which the vertices of a binary tree can be systematically traversed or ordered. They are preorder, inorder a 阅读全文
posted @ 2012-03-28 17:49 江财小子 阅读(621) 评论(0) 推荐(0) 编辑