摘要: DescriptionGiven a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5 + 4 = 14.InputThe first line of the input contains an integer T(1 2 #include 3 4 using namespace std; 5 6 int.. 阅读全文
posted @ 2013-08-06 00:36 小の泽 阅读(113) 评论(0) 推荐(0) 编辑
摘要: DescriptionNowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good boy, and know little about this game, so I introduce it to you now.The game can be played by two or more than two players. It consists of a chessboard(棋盘)and some chessmen 阅读全文
posted @ 2013-08-06 00:33 小の泽 阅读(160) 评论(0) 推荐(0) 编辑
摘要: DescriptionA subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = another sequence Z = is a subsequence of X if there exists a strictly increasing sequence of indices of X such that for all j = 1,2,...,k, xij = zj. For example, Z ... 阅读全文
posted @ 2013-08-06 00:28 小の泽 阅读(151) 评论(0) 推荐(0) 编辑
摘要: DescriptionNow 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 digit. When add 1 to '9', the digit will change to be '1' and when minus 1 to '1', the dig 阅读全文
posted @ 2013-08-06 00:24 小の泽 阅读(177) 评论(0) 推荐(0) 编辑
摘要: DescriptionA factory produces products packed in square packets of the same height h and of the sizes 1*1, 2*2, 3*3, 4*4, 5*5, 6*6. These products are always delivered to customers in the square parcels of the same height h as the products have and of the size 6*6. Because of the expenses it is the 阅读全文
posted @ 2013-08-06 00:18 小の泽 阅读(473) 评论(0) 推荐(0) 编辑
摘要: DescriptionThere is a pile of n wooden sticks. The length and weight of each stick are known in advance. The sticks are to be processed by a woodworking machine in one by one fashion. It needs some time, called setup time, for the machine to prepare processing a stick. The setup times are associated 阅读全文
posted @ 2013-08-06 00:14 小の泽 阅读(185) 评论(0) 推荐(0) 编辑
摘要: DescriptionA tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between nodes satisfying the following properties. There is exactly one node, called the root, to which no directed edges point. Every node except 阅读全文
posted @ 2013-08-05 21:13 小の泽 阅读(187) 评论(0) 推荐(0) 编辑
摘要: DescriptionSevere acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, the best strategy is to separate the suspects from others. In the Not-Spreading-Your-Sickness University (NSYSU), 阅读全文
posted @ 2013-08-05 20:06 小の泽 阅读(182) 评论(0) 推荐(0) 编辑
摘要: Description动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。 有人用两种说法对这N个动物所构成的食物链关系进行描述: 第一种说法是"1 X Y",表示X和Y是同类。 第二种说法是"2 X Y",表示X吃Y。 此人对N个动物,用上述两种说法,一句接一句地说出K句话,这K句话有的是真的,有的是假的。当一句话满足下列三条之一时,这句话就是假话,否则就是真话。 1) 当前的话与前面的某些真的话冲突,就是假话; 2) 阅读全文
posted @ 2013-08-05 14:59 小の泽 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 最近几天学习了并查集。并查集干的无非就是两件事:并和查。当然在查的时候要进行路径压缩,这个我之后会说。 首先很感谢这个例子,让我明白了并查集实质是什么。 下面就来看这个例子: 话说江湖上散落着各式各样的大侠,有上千个之多。他们没有什么正当职业,整天背着剑在外面走来走去,碰到和自己不是一路人的,就免不了要打一架。但 大侠们有一个优点就是讲义气,绝对不打自己的朋友。而且他们信奉“朋友的朋友就是我的朋友”,只要是能通过朋友关系串联起来的,不管拐了多少个弯,都认为 是自己人。这样一来,江湖上就形成了一个一个的群落,通过两两之间的朋友关系串联起来。而不在同一个群落的人,无论如何都无法通... 阅读全文
posted @ 2013-08-05 14:51 小の泽 阅读(178) 评论(0) 推荐(0) 编辑