03 2015 档案

摘要:Description 有一天Petya和他的朋友Vasya在进行他们众多旅行中的一次旅行,他们决定去参观一座城堡博物馆。这座博物馆有着特别的样式。它包含由m条走廊连接的n间房间,并且满足可以从任何一间房间到任何一间别的房间。两个人在博物馆里逛了一会儿后两人决定分头行动,去看各自感兴趣的艺术品。他... 阅读全文
posted @ 2015-03-31 22:36 TCtower 阅读(415) 评论(0) 推荐(0)
摘要:All submissions for this problem are available.Read problems statements in Mandarin Chinese and Russian.This problem's statement is really a short on... 阅读全文
posted @ 2015-03-31 21:26 TCtower 阅读(358) 评论(0) 推荐(0)
摘要:Description根据一些书上的记载,上帝的一次失败的创世经历是这样的:第一天, 上帝创造了一个世界的基本元素,称做“元”。第二天, 上帝创造了一个新的元素,称作“α”。“α”被定义为“元”构成的集合。容易发现,一共有两种不同的“α”。第三天, 上帝又创造了一个新的元素,称作“β”。“β”被定义... 阅读全文
posted @ 2015-03-31 20:32 TCtower 阅读(1162) 评论(0) 推荐(1)
摘要:Vasya is sitting on an extremely boring math class. To have fun, he took a piece of paper and wrote out nnumbers on a single line. After that, Vasya b... 阅读全文
posted @ 2015-03-31 20:06 TCtower 阅读(412) 评论(0) 推荐(0)
摘要:DescriptionHH有个一成不变的习惯,喜欢饭后百步走。所谓百步走,就是散步,就是在一定的时间 内,走过一定的距离。 但是同时HH又是个喜欢变化的人,所以他不会立刻沿着刚刚走来的路走回。 又因为HH是个喜欢变化的人,所以他每天走过的路径都不完全一样,他想知道他究竟有多 少种散步的方法。 现在给... 阅读全文
posted @ 2015-03-31 17:16 TCtower 阅读(189) 评论(0) 推荐(0)
摘要:DescriptionA young schoolboy would like to calculate the sum for some fixed natural k and different natural n. He observed that calculating ik for all... 阅读全文
posted @ 2015-03-31 09:07 TCtower 阅读(335) 评论(0) 推荐(0)
摘要:试题来源 2013中国国家集训队第二次作业问题描述 刚刚解决完电力网络的问题, 阿狸又被领导的任务给难住了. 刚才说过, 阿狸的国家有n个城市, 现在国家需要在某些城市对之间建立一些贸易路线, 使得整个国家的任意两个城市都直接或间接的连通. 为了省钱, 每两个城市之间最多只能有一条直接的贸易... 阅读全文
posted @ 2015-03-30 20:09 TCtower 阅读(617) 评论(0) 推荐(0)
摘要:Problem DescriptionCalculate A * B.InputEach line will contain two integers A and B. Process to end of file.Note: the length of each integer will not ... 阅读全文
posted @ 2015-03-30 17:51 TCtower 阅读(162) 评论(0) 推荐(0)
摘要:【问题描述】给出n个数qi,给出Fj的定义如下:令Ei=Fi/qi。试求Ei。【输入格式】输入文件force.in包含一个整数n,接下来n行每行输入一个数,第i行表示qi。【输出格式】输出文件force.out有n行,第i行输出Ei。与标准答案误差不超过1e-2即可。【样例输入】54006373.8... 阅读全文
posted @ 2015-03-30 11:46 TCtower 阅读(308) 评论(0) 推荐(1)
摘要:问题描述 给定三次函数f(x)=ax3+bx2+cx+d的4个系数a,b,c,d,以及一个数z,请用牛顿迭代法求出函数f(x)=0在z附近的根,并给出迭代所需要次数。 牛顿迭代法的原理如下(参考下图): 设xk是方程f(x)=0的精确解x*附近的一个猜测解,过点Pk(xk,f(xk))作f(x... 阅读全文
posted @ 2015-03-30 08:36 TCtower 阅读(551) 评论(0) 推荐(0)
摘要:问题描述 离散傅立叶变换在信号处理中扮演者重要的角色。利用傅立叶变换,可以实现信号在时域和频域之间的转换。 对于一个给定的长度为n=2m (m为整数) 的复数序列X0, X1, …, Xn-1,离散傅立叶变换将得到另一个长度为n的复数序列Y0, Y1, …, Yn-1。其中 Yi=X0+X1w... 阅读全文
posted @ 2015-03-30 07:48 TCtower 阅读(293) 评论(0) 推荐(0)
摘要:Problem DescriptionCalculate A * B.InputEach line will contain two integers A and B. Process to end of file.Note: the length of each integer will not ... 阅读全文
posted @ 2015-03-29 20:21 TCtower 阅读(202) 评论(0) 推荐(0)
摘要:DescriptionGiven a big integer number, you are required to find out whether it's a prime number.InputThe first line contains the number of test cases ... 阅读全文
posted @ 2015-03-27 19:04 TCtower 阅读(171) 评论(0) 推荐(0)
摘要:转载:http://trinklee.blog.163.com/blog/static/23815806020150155296528/问题描述:众所周知,在国王胖哥的带领下,K国国泰民安,空前繁荣,但今天K国却遇到了空前的危机。在K国境内同时发现了n个未知的病毒,每个病毒会从它被发现的位置开始感染... 阅读全文
posted @ 2015-03-27 15:55 TCtower 阅读(413) 评论(0) 推荐(0)
摘要:Given a positive integer, your job is writing a program to determine whether it is a prime number or not.InputThere are several tests. Each test consi... 阅读全文
posted @ 2015-03-27 15:00 TCtower 阅读(264) 评论(0) 推荐(0)
摘要:Description4x4 tic-tac-toe is played on a board with four rows (numbered 0 to 3 from top to bottom) and four columns (numbered 0 to 3 from left to rig... 阅读全文
posted @ 2015-03-22 19:28 TCtower 阅读(283) 评论(0) 推荐(0)
摘要:DescriptionYou all know the Dirichlet principle, the point of which is that if n boxes have no less than n + 1 items, that leads to the existence of a... 阅读全文
posted @ 2015-03-22 18:15 TCtower 阅读(218) 评论(0) 推荐(0)
摘要:Description黑白棋(game)【问题描述】小A和小B又想到了一个新的游戏。这个游戏是在一个1*n的棋盘上进行的,棋盘上有k个棋子,一半是黑色,一半是白色。最左边是白色棋子,最右边是黑色棋子,相邻的棋子颜色不同。E小A可以移动白色棋子,小B可以移动黑色的棋子,他们每次操作可以移动1到d个棋子... 阅读全文
posted @ 2015-03-22 16:09 TCtower 阅读(511) 评论(2) 推荐(0)
摘要:Problem DescriptionIn ACM_DIY, there is one master called “Lost”. As we know he is a “-2Dai”, which means he has a lot of money.Well, Lost use Ipad an... 阅读全文
posted @ 2015-03-20 16:43 TCtower 阅读(374) 评论(0) 推荐(0)
摘要:DescriptionLittle Y finds there is a very interesting formula in mathematics:XY mod Z = KGiven X, Y, Z, we all know how to figure out K fast. However,... 阅读全文
posted @ 2015-03-20 10:04 TCtower 阅读(201) 评论(0) 推荐(0)
摘要:Problem DescriptionThe picture indicates a tree, every node has 2 children.The depth of the nodes whose color is blue is 3; the depth of the node whos... 阅读全文
posted @ 2015-03-20 08:27 TCtower 阅读(524) 评论(0) 推荐(0)
摘要:1 /* 2 唐代杜荀鹤 3 《小松》 4 自小刺头深草里,而今渐觉出蓬蒿。 5 时人不识凌云木,直待凌云始道高。 6 */ 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include 13... 阅读全文
posted @ 2015-03-18 20:01 TCtower 阅读(121) 评论(0) 推荐(0)
摘要:1 /* 2 唐代李白 3 《江夏别宋之悌》 4 楚水清若空,遥将碧海通。人分千里外,兴在一杯中。 5 谷鸟吟晴日,江猿啸晚风。平生不下泪,于此泣无穷. 6 */ 7 #include 8 #include 9 #include 10 #include 11 #include 12 #incl... 阅读全文
posted @ 2015-03-18 17:29 TCtower 阅读(140) 评论(0) 推荐(0)
摘要:Description这天,SJY显得无聊。在家自己玩。在一个棋盘上,有N个黑色棋子。他每次要么放到棋盘上一个黑色棋子,要么放上一个白色棋子,如果是白色棋子,他会找出距离这个白色棋子最近的黑色棋子。此处的距离是 曼哈顿距离 即(|x1-x2|+|y1-y2|) 。现在给出N 8 #include ... 阅读全文
posted @ 2015-03-18 09:23 TCtower 阅读(289) 评论(0) 推荐(0)
摘要:Description小 T有一个很大的书柜。这个书柜的构造有些独特,即书柜里的书是从上至下堆放成一列。她用1到n的正整数给每本书都编了号。 小T在看书的时候,每次取出一本书,看完后放回书柜然后再拿下一本。由于这些书太有吸引力了,所以她看完后常常会忘记原来是放在书柜的什么位置。不过小T 的记忆力是非... 阅读全文
posted @ 2015-03-17 21:31 TCtower 阅读(202) 评论(0) 推荐(0)
摘要:Description作为一个生活散漫的人,小Z每天早上都要耗费很久从一堆五颜六色的袜子中找出一双来穿。终于有一天,小Z再也无法忍受这恼人的找袜子过程,于是他决定听天由命……具体来说,小Z把这N只袜子从1到N编号,然后从编号L到R(L尽管小Z并不在意两只袜子是不是完整的一双,甚至不在意两只袜子是否一... 阅读全文
posted @ 2015-03-17 20:10 TCtower 阅读(149) 评论(0) 推荐(0)
摘要:DescriptionM 公司是一个非常庞大的跨国公司,在许多国家都设有它的下属分支机构或部门。为了让分布在世界各地的N个部门之间协同工作,公司搭建了一个连接整个公司的通 信网络。该网络的结构由N个路由器和N-1条高速光缆组成。每个部门都有一个专属的路由器,部门局域网内的所有机器都联向这个路由器,然... 阅读全文
posted @ 2015-03-17 19:19 TCtower 阅读(221) 评论(0) 推荐(0)
摘要:Description墨墨购买了一套N支彩色画笔(其中有些颜色可能相同),摆成一排,你需要回答墨墨的提问。墨墨会像你发布如下指令: 1、 Q L R代表询问你从第L支画笔到第R支画笔中共有几种不同颜色的画笔。 2、 R P Col 把第P支画笔替换为颜色Col。为了满足墨墨的要求,你知道你需要干什么... 阅读全文
posted @ 2015-03-17 14:52 TCtower 阅读(282) 评论(0) 推荐(0)
摘要:Description 一个长度为n的序列a,设其排过序之后为b,其中位数定义为b[n/2],其中a,b从0开始标号,除法取下整。 给你一个长度为n的序列s。 回答Q个这样的询问:s的左端点在[a,b]之间,右端点在[c,d]之间的子序列中,最大的中位数。 其中a 8 #includ... 阅读全文
posted @ 2015-03-17 09:13 TCtower 阅读(197) 评论(0) 推荐(0)
摘要:Description一 棵树上有n个节点,编号分别为1到n,每个节点都有一个权值w。我们将以下面的形式来要求你对这棵树完成一些操作: I. CHANGE u t : 把结点u的权值改为t II. QMAX u v: 询问从点u到点v的路径上的节点的最大权值 III. QSUM u v: 询问从点u... 阅读全文
posted @ 2015-03-16 20:46 TCtower 阅读(285) 评论(0) 推荐(0)
摘要:Description辉 辉热衷于洞穴勘测。某天,他按照地图来到了一片被标记为JSZX的洞穴群地区。经过初步勘测,辉辉发现这片区域由n个洞穴(分别编号为1到n)以及若干通 道组成,并且每条通道连接了恰好两个洞穴。假如两个洞穴可以通过一条或者多条通道按一定顺序连接起来,那么这两个洞穴就是连通的,按顺序... 阅读全文
posted @ 2015-03-16 20:15 TCtower 阅读(221) 评论(0) 推荐(0)
摘要:Problem DescriptionWe have met so many problems on the tree, so today we will have a query problem on a set of trees. There are N nodes, each nod... 阅读全文
posted @ 2015-03-16 17:27 TCtower 阅读(166) 评论(0) 推荐(0)
摘要:Description一 棵树上有n个节点,编号分别为1到n,每个节点都有一个权值w。我们将以下面的形式来要求你对这棵树完成一些操作: I. CHANGE u t : 把结点u的权值改为t II. QMAX u v: 询问从点u到点v的路径上的节点的最大权值 III. QSUM u v: 询问从点u... 阅读全文
posted @ 2015-03-16 11:30 TCtower 阅读(213) 评论(0) 推荐(0)
摘要:DescriptionYou are given a tree with N nodes. The tree’s nodes are numbered 1 through N and its edges are numbered 1 through N − 1. Each edge is assoc... 阅读全文
posted @ 2015-03-16 09:49 TCtower 阅读(148) 评论(0) 推荐(0)
摘要:http://pan.baidu.com/share/link?shareid=318543&uk=235772034 阅读全文
posted @ 2015-03-15 21:39 TCtower 阅读(132) 评论(0) 推荐(0)
摘要:DescriptionYou have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to ... 阅读全文
posted @ 2015-03-15 19:17 TCtower 阅读(230) 评论(0) 推荐(0)
摘要:Description有N个位置,M个操作。操作有两种,每次操作如果是1 a b c的形式表示在第a个位置到第b个位置,每个位置加入一个数c如果是2 a b c形式,表示询问从第a个位置到第b个位置,第C大的数是多少。Input第一行N,M接下来M行,每行形如1 a b c或2 a b cOutpu... 阅读全文
posted @ 2015-03-15 17:09 TCtower 阅读(450) 评论(0) 推荐(0)
摘要:The Company Dynamic Rankings has developed a new kind of computer that is no longer satisfied with the query like to simply find the k-th smallest num... 阅读全文
posted @ 2015-03-15 15:12 TCtower 阅读(1362) 评论(0) 推荐(2)
摘要:DescriptionYou are working for Macrohard company in data structures department. After failing your previous task about key insertion you were asked to... 阅读全文
posted @ 2015-03-14 21:12 TCtower 阅读(499) 评论(0) 推荐(0)
摘要:试题来源 2012中国国家集训队命题答辩问题描述 给你一个N*N的矩阵,不用算矩阵乘法,但是每次询问一个子矩形的第K小数。输入格式 第一行两个数N,Q,表示矩阵大小和询问组数; 接下来N行N列一共N*N个数,表示这个矩阵; 再接下来Q行每行5个数描述一个询问:x1,y1,x2,y2,k表示... 阅读全文
posted @ 2015-03-14 16:58 TCtower 阅读(287) 评论(0) 推荐(0)
摘要:DescriptionY901高速公路是一条重要的交通纽带,政府部门建设初期的投入以及使用期间的养护费用都不低,因此政府在这条高速公路上设立了许多收费站。Y901高速公路是一条由N-1段路以及N个收费站组成的东西向的链,我们按照由西向东的顺序将收费站依次编号为1~N,从收费站i行驶到i+1(或从i+... 阅读全文
posted @ 2015-03-14 16:12 TCtower 阅读(146) 评论(0) 推荐(0)
摘要:DescriptionN children are sitting in a circle to play a game.The children are numbered from 1 to N in clockwise order. Each of them has a card with a ... 阅读全文
posted @ 2015-03-14 10:18 TCtower 阅读(208) 评论(0) 推荐(0)
摘要:DescriptionFleeting time does not blur my memory of you. Can it really be 4 years since I first saw you? I still remember, vividly, on the beautiful Z... 阅读全文
posted @ 2015-03-13 22:35 TCtower 阅读(194) 评论(0) 推荐(0)
摘要:Problem DescriptionBackgroundTo The Moon is a independent game released in November 2011, it is a role-playing adventure game powered by RPG Maker.The... 阅读全文
posted @ 2015-03-13 20:29 TCtower 阅读(242) 评论(0) 推荐(0)
摘要:Descriptionn个集合 m个操作操作:1 a b 合并a,b所在集合2 k 回到第k次操作之后的状态(查询算作操作)3 a b 询问a,b是否属于同一集合,是则输出1否则输出00 11 #include 12 #include 13 #include 14 #include 15 #... 阅读全文
posted @ 2015-03-13 15:56 TCtower 阅读(307) 评论(0) 推荐(0)
摘要:DescriptionThe "Informatics" hotel is one of the most luxurious hotels from Galaciuc. A lot of tourists arrive or leave this hotel in one year. So it ... 阅读全文
posted @ 2015-03-13 10:14 TCtower 阅读(207) 评论(0) 推荐(0)
摘要:DescriptionThere are several ancient Greek texts that contain descriptions of the fabled island Atlantis. Some of these texts even include maps of par... 阅读全文
posted @ 2015-03-13 08:51 TCtower 阅读(183) 评论(0) 推荐(0)
摘要:DescriptionEvery morning when they are milked, the Farmer John's cows form a rectangular grid that is R (1 11 #include 12 #include 13 #include 14 ... 阅读全文
posted @ 2015-03-12 22:16 TCtower 阅读(325) 评论(0) 推荐(0)
摘要:DescriptionThe little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat to give names to their newly-... 阅读全文
posted @ 2015-03-12 20:47 TCtower 阅读(206) 评论(0) 推荐(0)
摘要:DescriptionGiven two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think... 阅读全文
posted @ 2015-03-12 20:12 TCtower 阅读(193) 评论(0) 推荐(0)
摘要:DescriptionThe French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter'e'. He was a member of the Oulipo group. ... 阅读全文
posted @ 2015-03-12 20:04 TCtower 阅读(195) 评论(0) 推荐(0)
摘要:DescriptionN个布丁摆成一行,进行M次操作.每次将某个颜色的布丁全部变成另一种颜色的,然后再询问当前一共有多少段颜色.例如颜色分别为1,2,2,1的四个布丁一共有3段颜色.Input第一行给出N,M表示布丁的个数和好友的操作次数. 第二行N个数A1,A2...An表示第i个布丁的颜色从第三... 阅读全文
posted @ 2015-03-12 19:31 TCtower 阅读(201) 评论(0) 推荐(0)
摘要:Description在一个忍者的帮派里,一些忍者们被选中派遣给顾客,然后依据自己的工作获取报偿。在这个帮派里,有一名忍者被称之为Master。除了Master以外,每名忍者都有且仅有一个上级。为保密,同时增强忍者们的领导力,所有与他们工作相关的指令总是由上级发送给他的直接下属,而不允许通过其他的方... 阅读全文
posted @ 2015-03-12 16:25 TCtower 阅读(308) 评论(0) 推荐(0)
摘要:Problem DescriptionYaoYao is fond of playing his chains. He has a chain containing n diamonds on it. Diamonds are numbered from 1 to n.At first, the d... 阅读全文
posted @ 2015-03-12 09:54 TCtower 阅读(258) 评论(0) 推荐(0)
摘要:DescriptionYour friend, Jackson is invited to a TV show called SuperMemo in which the participant is told to play a memorizing game. At first, the hos... 阅读全文
posted @ 2015-03-11 22:59 TCtower 阅读(234) 评论(0) 推荐(0)
摘要:DescriptionThe new founded Balkan Investment Group Bank (BIG-Bank) opened a new office in Bucharest, equipped with a modern computing environment prov... 阅读全文
posted @ 2015-03-11 17:27 TCtower 阅读(185) 评论(0) 推荐(0)
摘要:原帖:http://www.cnblogs.com/chain2012/archive/2010/11/12/1875578.html因为Windows的内核对象也运用了引用计数,所以稍作了解并非无用。引用计数可以让多个对象共享一个数据,而且免除了跟踪控制权的负担,让对象自己管理自己,当再没有被使用... 阅读全文
posted @ 2015-03-11 11:13 TCtower 阅读(1976) 评论(0) 推荐(0)
摘要:DescriptionWind loves pretty dogs very much, and she has n pet dogs. So Jiajia has to feed the dogs every day for Wind. Jiajia loves Wind, but not the... 阅读全文
posted @ 2015-03-11 10:58 TCtower 阅读(210) 评论(0) 推荐(0)
摘要:DescriptionYou haveNintegers,A1,A2, ... ,AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each ... 阅读全文
posted @ 2015-03-11 10:23 TCtower 阅读(227) 评论(0) 推荐(0)
摘要:DescriptionYour friend, Jackson is invited to a TV show called SuperMemo in which the participant is told to play a memorizing game. At first, the hos... 阅读全文
posted @ 2015-03-11 09:11 TCtower 阅读(278) 评论(0) 推荐(0)
摘要:DescriptionInput输入文件的第1行包含两个数N和M,N表示初始时数列中数的个数,M表示要进行的操作数目。第2行包含N个数字,描述初始时的数列。以下M行,每行一条命令,格式参见问题描述中的表格。Output对于输入数据中的GET-SUM和MAX-SUM操作,向输出文件依次打印结果,每个答... 阅读全文
posted @ 2015-03-10 20:06 TCtower 阅读(404) 评论(0) 推荐(0)
摘要:原帖:http://fanhq666.blog.163.com/blog/static/819434262011021105212299/你的Treap能支持以下操作吗?1.区间增减2.区间求最小3.区间反转(倒序)4.区间移动(把一段剪切、粘贴)不能?只能用splay?其实,Treap也可以办到。... 阅读全文
posted @ 2015-03-10 14:35 TCtower 阅读(254) 评论(0) 推荐(0)
摘要:DescriptionNewman likes playing with cats. He possesses lots of cats in his home. Because the number of cats is really huge, Newman wants to group som... 阅读全文
posted @ 2015-03-10 14:20 TCtower 阅读(318) 评论(0) 推荐(0)
摘要:DescriptionOur Black Box represents a primitive database. It can save an integer array and has a special i variable. At the initial moment Black Box i... 阅读全文
posted @ 2015-03-10 09:20 TCtower 阅读(197) 评论(0) 推荐(0)
摘要:Problem DescriptionSean owns a company and he is the BOSS.The other Staff has one Superior.every staff has a loyalty and ability.Some times Sean will ... 阅读全文
posted @ 2015-03-10 08:44 TCtower 阅读(249) 评论(0) 推荐(0)
摘要:原帖:http://www.cnblogs.com/lvpengms/archive/2010/02/08/1666095.html晚上闲着没事干,鉴于前一段时间数学建模中看到了生命游戏 Game of Life,所以用C++实现一下,效果还不错。 本程序是用vs2005 C++编写,有意想要程序... 阅读全文
posted @ 2015-03-09 23:13 TCtower 阅读(693) 评论(0) 推荐(0)
摘要:DescriptionFOTILE得到了一个长为N的序列A,为了拯救地球,他希望知道某些区间内的最大的连续XOR和。即对于一个询问,你需要求出max(Ai xor Ai+1 xor Ai+2 ... xor Aj),其中l 2 #include 3 #include 4 #include ... 阅读全文
posted @ 2015-03-09 22:49 TCtower 阅读(433) 评论(0) 推荐(0)
摘要:Description对于序列A,它的逆序对数定义为满足iAj的数对(i,j)的个数。给1到n的一个排列,按照某种顺序依次删除m个元素,你的任务是在每次删除一个元素之前统计整个序列的逆序对数。Input输入第一行包含两个整数n和m,即初始元素的个数和删除的元素个数。以下n行每行包含一个1到n之间的正... 阅读全文
posted @ 2015-03-09 14:12 TCtower 阅读(247) 评论(0) 推荐(0)
摘要: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 it... 阅读全文
posted @ 2015-03-09 09:09 TCtower 阅读(295) 评论(0) 推荐(0)
摘要:DescriptionYou are given a string and supposed to do some string manipulations.InputThe first line of the input contains the initial string. You can a... 阅读全文
posted @ 2015-03-08 22:13 TCtower 阅读(495) 评论(0) 推荐(0)
摘要:Description给你一个无向图,N(N 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 13 co... 阅读全文
posted @ 2015-03-08 19:47 TCtower 阅读(160) 评论(0) 推荐(0)
摘要:DescriptionInputOutput每次x=1时,每行一个整数,表示这次旅行的开心度Sample Input41 100 5 551 1 22 1 21 1 22 2 31 1 4Sample Output1011111【分析】开始看一眼觉得线段树可做。后来看题解用树状数组瞬秒......o... 阅读全文
posted @ 2015-03-08 19:29 TCtower 阅读(262) 评论(0) 推荐(0)
摘要:DescriptionAfter having drifted about in a small boat for a couple of days, Akira Crusoe Maeda was finally cast ashore on a foggy island. Though he wa... 阅读全文
posted @ 2015-03-08 18:22 TCtower 阅读(190) 评论(0) 推荐(0)
摘要:DescriptionNchildren are playing Rochambeau (scissors-rock-cloth) game with you. One of them is the judge. The rest children are divided into three gr... 阅读全文
posted @ 2015-03-08 17:13 TCtower 阅读(137) 评论(0) 推荐(0)
摘要:DescriptionNow and then you play the following game with your friend. Your friend writes down a sequence consisting of zeroes and ones. You choose a c... 阅读全文
posted @ 2015-03-08 15:48 TCtower 阅读(226) 评论(0) 推荐(0)
摘要:Description现在请求你维护一个数列,要求提供以下两种操作: 1、 查询操作。语法:Q L 功能:查询当前数列中末尾L个数中的最大的数,并输出这个数的值。限制:L不超过当前数列的长度。 2、 插入操作。语法:A n 功能:将n加上t,其中t是最近一次查询操作的答案(如果还未执行过查询操作,则... 阅读全文
posted @ 2015-03-07 15:56 TCtower 阅读(538) 评论(0) 推荐(0)
摘要:原帖:http://www.cnblogs.com/zgmf_x20a/archive/2008/11/15/1334109.html回顾树状数组的定义,注意到有如下两条性质: 一,c[ans]=sum of A[ans-lowbit(ans)+1 ... ans];二,当ans=2^k时,c[an... 阅读全文
posted @ 2015-03-07 15:26 TCtower 阅读(219) 评论(0) 推荐(0)
摘要:DescriptionYou haveNintegers,A1,A2, ... ,AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each ... 阅读全文
posted @ 2015-03-07 15:07 TCtower 阅读(210) 评论(0) 推荐(0)
摘要:DescriptionGiven an N*N matrix A, whose elements are either 0 or 1. A[i, j] means the number in the i-th row and j-th column. Initially we have A[i, j... 阅读全文
posted @ 2015-03-07 11:42 TCtower 阅读(206) 评论(0) 推荐(0)
摘要:DescriptionAstronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level... 阅读全文
posted @ 2015-03-07 10:53 TCtower 阅读(162) 评论(0) 推荐(0)
摘要:DescriptionSuppose that the fourth generation mobile phone base stations in the Tampere area operate as follows. The area is divided into squares. The... 阅读全文
posted @ 2015-03-07 10:31 TCtower 阅读(258) 评论(0) 推荐(0)
摘要:As most of the ACMers, wy's next target is algorithms, too. wy is clever, so he can learn most of the algorithms quickly. After a short time, he has l... 阅读全文
posted @ 2015-03-07 10:24 TCtower 阅读(162) 评论(0) 推荐(0)
摘要:DescriptionIn this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping ... 阅读全文
posted @ 2015-03-07 08:33 TCtower 阅读(183) 评论(0) 推荐(0)