2013年5月1日
摘要: Problem DescriptionAs a amateur artist, Xenocide loves painting the wall. The wall can be considered as a line consisting of n nodes. Each node has its own color.Xenocide spends all day in front of the wall. Sometimes, he paints some consecutive nodes so that these nodes have the same color. When h. 阅读全文
posted @ 2013-05-01 15:28 耶稣爱你 阅读(374) 评论(0) 推荐(0) 编辑
  2013年4月30日
摘要: Problem DescriptionA lot of battleships of evil are arranged in a line before the battle. Our commander decides to use our secret weapon to eliminate the battleships. Each of the battleships can be marked a value of endurance. For every attack of our secret weapon, it could decrease the endurance of 阅读全文
posted @ 2013-04-30 15:38 耶稣爱你 阅读(145) 评论(0) 推荐(0) 编辑
  2013年4月29日
摘要: Problem DescriptionN个气球排成一排,从左到右依次编号为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个气球总共 阅读全文
posted @ 2013-04-29 21:42 耶稣爱你 阅读(115) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionIn the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sticks which are of the same length.Now Pudge wants to do some operations on the hook.Let us number the consecutive metallic stick 阅读全文
posted @ 2013-04-29 20:39 耶稣爱你 阅读(176) 评论(0) 推荐(0) 编辑
  2013年4月28日
摘要: 描述南将军手下有N个士兵,分别编号1到N,这些士兵的杀敌数都是已知的。小工是南将军手下的军师,南将军经常想知道第m号到第n号士兵的总杀敌数,请你帮助小工来回答南将军吧。南将军的某次询问之后士兵i可能又杀敌q人,之后南将军再询问的时候,需要考虑到新增的杀敌数。输入只有一组测试数据 第一行是两个整数N,M,其中N表示士兵的个数(1<N<1000000),M表示指令的条数。(1<M<100000) 随后的一行是N个整数,ai表示第i号士兵杀敌数目。(0<=ai<=100) 随后的M行每行是一条指令,这条指令包含了一个字符串和两个整数,首先是一个字符串,如果是字符串 阅读全文
posted @ 2013-04-28 23:29 耶稣爱你 阅读(292) 评论(0) 推荐(0) 编辑
摘要: 描述小明得到了一张写有奇怪字符串的纸,他想知道一些字符串出现了多少次,但这些字符串太多了,他想找你帮忙,你能帮他吗?输入字符包括所有小写字母、‘@’、‘+’。输入第一行包含一个整数T(T<=100).表示测试数据组数。 接下来每组数据第一行包含两个整数n,m(n,m<100000),分别表示有n个字符串,小明要问你m次。 接下来n行,每行包含一个字符串,长度不大于15。 接下来m行,每行包含一个字符串,表示小明要问该串出现的次数。输出输出每组小明询问数串出现的次数。#include<iostream>using namespace std;class node{ pub 阅读全文
posted @ 2013-04-28 13:04 耶稣爱你 阅读(241) 评论(0) 推荐(0) 编辑
  2013年4月27日
摘要: InputThe input consists of T test cases. The number of test cases (T) is given in the first line of the input file. Each test case starts with a line containing an integer N , the number of nodes in a tree, 2<=N<=10,000. The nodes are labeled with integers 1, 2,..., N. Each of the next N -1 li 阅读全文
posted @ 2013-04-27 21:23 耶稣爱你 阅读(169) 评论(0) 推荐(0) 编辑
摘要: DescriptionThe police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in the city, Gang Dragon and Gang Snake. However, the police first needs to identify which gang a criminal belongs to. The present question is, given two criminals; do they belong t 阅读全文
posted @ 2013-04-27 18:24 耶稣爱你 阅读(270) 评论(0) 推荐(0) 编辑
摘要: 描述动物王国中有三类动物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) 当前的话中X或Y比N大,就是假 阅读全文
posted @ 2013-04-27 15:42 耶稣爱你 阅读(384) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionBackground Professor Hopper is researching the sexual behavior of a rare species of bugs. He assumes that they feature two different genders and that they only interact with bugs of the opposite gender. In his experiment, individual bugs and their interactions were easy to identi. 阅读全文
posted @ 2013-04-27 10:46 耶稣爱你 阅读(343) 评论(0) 推荐(0) 编辑