摘要: Fibonacci again and againTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 67 Accepted Submission(s): 45 Problem Description 任何一个大学生对菲波那契数列(Fibonacci numbers)应该都不会陌生,它是这样定义的:F(1)=1;F(2)=2;F(n)=F(n-1)+F(n-2)(n>=3);所以,1,2,3,5,8,13……就是... 阅读全文
posted @ 2013-07-22 10:30 cssystem 阅读(367) 评论(0) 推荐(0) 编辑
摘要: Problem Description an = X*an-1 + Y and Y mod (X-1) = 0.Your task is to calculate the smallest positive integer k that ak mod a0 = 0. Input Each line will contain only three integers X, Y, a0 ( 1 < X < 231, 0 <= Y < 263, 0 < a0 < 231). Output For each case, output th... 阅读全文
posted @ 2013-07-14 11:37 cssystem 阅读(170) 评论(0) 推荐(0) 编辑
摘要: The Euler functionTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 134 Accepted Submission(s): 76 Problem Description The Euler function phi is an important kind of function in number theory, (n) represents the amount of the numbe... 阅读全文
posted @ 2013-07-14 00:43 cssystem 阅读(153) 评论(0) 推荐(0) 编辑
摘要: AssignmentsTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 48 Accepted Submission(s): 35 Problem Description In a factory, there are N workers to finish two types of tasks (A and B). Each type has N tasks. Each task of type A need... 阅读全文
posted @ 2013-07-13 22:15 cssystem 阅读(170) 评论(0) 推荐(0) 编辑
摘要: Problem Description Have you ever played quoit in a playground? Quoit is a game in which flat rings are pitched at some toys, with all the toys encircled awarded.In the field of Cyberground, the position of each toy is fixed, and the ring is carefully designed so it can only encircle one toy at a ti 阅读全文
posted @ 2013-07-13 22:13 cssystem 阅读(197) 评论(0) 推荐(0) 编辑
摘要: Problem Description There are a lot of trees in HDU. Kiki want to surround all the trees with the minimal required length of the rope . As follow, To make this problem more simple, consider all the trees are circles in a plate. The diameter of all the trees are the same (the diamet... 阅读全文
posted @ 2013-07-13 16:12 cssystem 阅读(435) 评论(0) 推荐(0) 编辑
摘要: ---恢复内容开始---Surround the TreesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 166 Accepted Submission(s): 81 Problem Description There are a lot of trees in an area. A peasant wants to buy a rope to surround all these trees. So at... 阅读全文
posted @ 2013-07-12 00:14 cssystem 阅读(255) 评论(0) 推荐(0) 编辑
摘要: 背景 BackgroundNOIP2012提高组题2描述 Description恰逢H国国庆,国王邀请n位大臣来玩一个有奖游戏。首先,他让每个大臣在左、右手上面分别写下一个整数,国王自己也在左、右手上各写一个整数。然 后,让这n位大臣排成一排,国王站在队伍的最前面。排好队后,所有的大臣都会获得国王奖赏的若干金币,每位大臣获得的金币数分别是:排在该大臣前面的 所有人的左手上的数的乘积除以他自己右手上的数,然后向下取整得到的结果。国王不希望某一个大臣获得特别多的奖赏,所以他想请你帮他重新安排一下队伍的顺序,使得获得奖赏最多的大臣,所获奖赏尽可能的少。注意,国王的位置始终在队伍的最前面。 ... 阅读全文
posted @ 2013-07-03 23:18 cssystem 阅读(488) 评论(0) 推荐(0) 编辑
摘要: 背景 Background清北学堂杯Tyvj2周年邀请赛第三道描述 DescriptionVNB从小立志当一名杰出的数学家。有一天,admin给了VNB一个任务:求int(√1)+int(√2)+……+int(√n)的值是多少。VNB 以为很简单,就接下了这个任务,但是当他看到n的范围大小就傻眼了。所以,他打着“节约计算用纸以保护地球”的口号向你发出了求救。注:int(x)表示实数x的整数部分。再注:VNB怕你算太长时间,就先帮你算出了int(√n)的大小,来帮助你更好的完成此题。 ... 阅读全文
posted @ 2013-07-03 23:08 cssystem 阅读(448) 评论(0) 推荐(0) 编辑
摘要: 背景 BackgroundAndyBear生日模拟赛第一题 描述 Description BIBO是个贪吃的小熊,她有很多喜欢的食物,但是为了控制体重,她每天不能吃的太多,因此小熊BIBO给每一种食物都赋了一个喜欢程度K,BIBO每天从她所有喜欢的食物中挑出一件喜欢程度最大的来吃,可能是蜂蜜,也可能是面包,同时小熊BIBO还会更改某一种食物的喜欢程度,或者说自己不喜欢某件食物了。你,作为小熊BIBO的... 阅读全文
posted @ 2013-07-03 23:06 cssystem 阅读(231) 评论(0) 推荐(0) 编辑
摘要: 背景 Background根据NOIP2010普及组复赛第二题改编描述 Description学校里有一个水房,水房里一共装有m个龙头可供同学们打开水,每个龙头每秒钟的供水量相等,均为1。现在有n名同学准备接水,他们的初始接水顺序已经确定。将这些同学按接水顺序从1到n编号,i号同学的接水量为wi。接水开始时,1到m号同学各占一个水龙头,并同时打开水龙头接水。当其中某名同学j完成其接水量要求wj后,下一名排队等候接水的同学k马上接替j同学的位置开始接水。这个换人的过程是瞬间完成的,且没有任何水的浪费。即j同学第x秒结束时完成接水,则k同学第x+1秒立刻开始接水。若当前接水人数n’不足m,则只有n 阅读全文
posted @ 2013-07-03 23:05 cssystem 阅读(478) 评论(0) 推荐(0) 编辑
摘要: 背景 Background公园里有个人在练开奔驰--!,但是总是撞在bench上(众人曰:狼来了,快跑啊!)描述 Description公园里的bench与奔驰都是无敌的,不会被撞坏。由于开奔驰的人比较"有特点",总是向上下左右四个方向开,而且只会在撞到椅子之后改变方向(起步时除外)--!现在他给你一张地图,上面标明他的位置、公园里的bench的位置和他想到达的位置,可能会有冲出地图的可能请你告诉他最少撞多少下才能到达目的地,并答应事成之后会给你一辆奔驰..............................................的照片 ... 阅读全文
posted @ 2013-07-03 23:01 cssystem 阅读(403) 评论(0) 推荐(0) 编辑
摘要: 描述 Description对于一个素数P,我们可以用一系列有理分数(分子、分母都是不大于N的自然数)来逼近sqrt(p),例如P=2,N=5的时候:1/1sqrt(p)),求X、Y、U、V,使x/yx^2/y^2 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 9 const int maxn=210;10 int x,a1,a2,b1,b2,z,n,p;11 double y,v;12 13 void close()14 {15 exit(0);16 }17 18 v... 阅读全文
posted @ 2013-07-03 23:00 cssystem 阅读(386) 评论(0) 推荐(0) 编辑
摘要: 好久都没写过日志了。。TAT描述 Description给你一个长度为n的数字串,数字串里会包含1-m这些数字。如果连续的一段数字子串包含了1-m这些数字,则称这个数字字串为NUM串。你的任务是求出长度最短的NUM串是什么,只需要输出这个长度即可。1m的就不合法,清空h,t,此外,用一个f数组记录每个数用了多少次,这样的话,一个合法的数字串假设是1 1 2 3 3 3 4那么我就知道一共出现的cnt=4,因为有F数组判重,这样的话,ans=min(ans,t-h+1);2、找到一个合法的数字串后,尝试从h处往t处删数,并保证数字串的性质,这样不管怎么都是O(n)的,因为h始终在增大,并只操作一 阅读全文
posted @ 2013-07-03 22:57 cssystem 阅读(503) 评论(0) 推荐(0) 编辑
摘要: Here We Go(relians) AgainTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 130 Accepted Submission(s): 85 Problem Description The Gorelians are a warlike race that travel the universe conquering new worlds as a form of recreation. G... 阅读全文
posted @ 2013-04-28 09:22 cssystem 阅读(198) 评论(0) 推荐(0) 编辑
摘要: TruckingTime Limit: 20000/10000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 72 Accepted Submission(s): 28 Problem Description A certain local trucking company would like to transport some goods on a cargo truck from one place to another. It is desi... 阅读全文
posted @ 2013-04-26 22:51 cssystem 阅读(176) 评论(0) 推荐(0) 编辑
摘要: In ActionTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 213 Accepted Submission(s): 94 Problem Description Since 1945, when the first nuclear bomb was exploded by the Manhattan Project team in the US, the number of nuclear we... 阅读全文
posted @ 2013-04-26 22:48 cssystem 阅读(132) 评论(0) 推荐(0) 编辑
摘要: ArbitrageTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 70 Accepted Submission(s): 37 Problem Description Arbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one uni... 阅读全文
posted @ 2013-04-26 22:46 cssystem 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 畅通工程续Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 42 Accepted Submission(s): 25 Problem Description 某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走... 阅读全文
posted @ 2013-04-26 22:44 cssystem 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 一个人的旅行Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 78 Accepted Submission(s): 35 Problem Description 虽然草儿是个路痴(就是在杭电待了一年多,居然还会在校园里迷路的人,汗~),但是草儿仍然很喜欢旅行,因为在旅途中 会遇见很多人(白马王子,^0^),很多事,还能丰富自己的阅历,还可以看美丽的风景……草儿想去很多地方,她想要去东京铁塔看夜景,去威尼斯... 阅读全文
posted @ 2013-04-26 22:43 cssystem 阅读(113) 评论(0) 推荐(0) 编辑
摘要: PseudoforestTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 182 Accepted Submission(s): 85 Problem Description In graph theory, a pseudoforest is an undirected graph in which every connected component has at most one cycle. The m... 阅读全文
posted @ 2013-04-26 22:41 cssystem 阅读(165) 评论(0) 推荐(0) 编辑
摘要: Connections between citiesTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 444 Accepted Submission(s): 142 Problem Description After World War X, a lot of cities have been seriously damaged, and we need to rebuild those cities. Ho... 阅读全文
posted @ 2013-04-26 22:38 cssystem 阅读(125) 评论(0) 推荐(0) 编辑
摘要: Connect the CitiesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 260 Accepted Submission(s): 93 Problem Description In 2100, since the sea level rise, most of the cities disappear. Though some survived cities are still connecte... 阅读全文
posted @ 2013-04-26 22:33 cssystem 阅读(139) 评论(0) 推荐(0) 编辑
摘要: Jungle RoadsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 87 Accepted Submission(s): 79 Problem DescriptionThe Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between... 阅读全文
posted @ 2013-04-26 22:30 cssystem 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 继续畅通工程Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 110 Accepted Submission(s): 90 Problem Description 省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。现得到城镇道路统计表,表中列出了任意两城镇间修建道路的费用,以及该道路是否已经修通的状态。现请你编写程序,计算出全省畅通需要的最... 阅读全文
posted @ 2013-04-26 22:28 cssystem 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 还是畅通工程Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 112 Accepted Submission(s): 86 Problem Description 某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。 ... 阅读全文
posted @ 2013-04-26 22:27 cssystem 阅读(100) 评论(0) 推荐(0) 编辑
摘要: Eddy's pictureTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 115 Accepted Submission(s): 85 Problem Description Eddy begins to like painting pictures recently ,he is sure of himself to become a painter.Every day Eddy draws pictu... 阅读全文
posted @ 2013-04-26 22:26 cssystem 阅读(212) 评论(0) 推荐(0) 编辑
摘要: 最短路Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 180 Accepted Submission(s): 100 Problem Description 在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗? Input ... 阅读全文
posted @ 2013-04-26 22:22 cssystem 阅读(162) 评论(0) 推荐(0) 编辑
摘要: Constructing RoadsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 127 Accepted Submission(s): 92 Problem Description There are N villages, which are numbered from 1 to N, and you should build some roads such that every two village... 阅读全文
posted @ 2013-04-26 22:20 cssystem 阅读(164) 评论(0) 推荐(0) 编辑
摘要: Increasing Speed LimitsTime Limit: 2000/10000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 101 Accepted Submission(s): 46 Problem Description You were driving along a highway when you got caught by the road police for speeding. It turns out that the... 阅读全文
posted @ 2013-03-31 23:40 cssystem 阅读(120) 评论(0) 推荐(0) 编辑
摘要: IntervieweTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 528 Accepted Submission(s): 134 Problem Description YaoYao has a company and he wants to employ m people recently. Since his company is so famous, there are n people coming... 阅读全文
posted @ 2013-03-31 23:37 cssystem 阅读(234) 评论(0) 推荐(0) 编辑
摘要: See you~Time Limit: 5000/3000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 144 Accepted Submission(s): 47 Problem Description Now I am leaving hust acm. In the past two and half years, I learned so many knowledge about Algorithm and Programming, and... 阅读全文
posted @ 2013-03-31 23:36 cssystem 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 畅通工程Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 104 Accepted Submission(s): 86 Problem Description 某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? In... 阅读全文
posted @ 2013-03-28 23:24 cssystem 阅读(167) 评论(0) 推荐(0) 编辑
摘要: Cow SortingTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 67 Accepted Submission(s): 35 Problem Description Sherlock's N (1 ≤ N ≤ 100,000) cows are lined up to be milked in the evening. Each cow has a unique "grumpiness" level in... 阅读全文
posted @ 2013-03-24 10:37 cssystem 阅读(227) 评论(0) 推荐(0) 编辑
摘要: 敌兵布阵Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 199 Accepted Submission(s): 123 Problem Description C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国... 阅读全文
posted @ 2013-03-24 10:31 cssystem 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 【2012四川省选】喵星球上的点名时间限制: 2000 ms 内存限制: 131072 KB【题目描述】a180285幸运地被选做了地球到喵星球的留学生。他发现喵星人在上课前的点名现象非常有趣。 假设课堂上有N个喵星人,每个喵星人的名字由姓和名构成。喵星球上的老师会选择M个串来点名,每次读出一个串的时候,如果这个串是一个喵星人的姓或名的子串,那么这个喵星人就必须答到。 然而,由于喵星人的字码过于古怪,以至于不能用ASCII码来表示。为了方便描述,a180285决定用数串来表示喵星人的名字。 现在你能帮助a180285统计每次点名的时候有多少喵星人答到,以及M次点名结束后每个喵星人答到多少次.. 阅读全文
posted @ 2013-03-15 20:40 cssystem 阅读(325) 评论(0) 推荐(0) 编辑
摘要: Milk PatternsTime Limit: 5000MSMemory Limit: 65536KTotal Submissions: 7337Accepted: 3331Case Time Limit: 2000MSDescriptionFarmer John has noticed that the quality of milk given by his cows varies from day to day. On further investigation, he discovered that although he can't predict the quality 阅读全文
posted @ 2013-03-15 20:27 cssystem 阅读(351) 评论(0) 推荐(0) 编辑
摘要: Long Long MessageTime Limit: 4000MSMemory Limit: 131072KTotal Submissions: 16819Accepted: 6828Case Time Limit: 1000MSDescriptionThe little cat is majoring in physics in the capital of Byterland. A piece of sad news comes to him these days: his mother is getting ill. Being worried about spending so m 阅读全文
posted @ 2013-03-15 20:21 cssystem 阅读(165) 评论(0) 推荐(0) 编辑
摘要: Musical ThemeTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 13852Accepted: 4810DescriptionA musical melody is represented as a sequence of N (1<=N<=20000)notes that are integers in the range 1..88, each representing a key on the piano. It is unfortunate but true that this representat 阅读全文
posted @ 2013-03-15 20:16 cssystem 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 首先吐槽一句:大神就是大神,写的东西我理解了三个月终于沾到边了!进入正题:http://wenku.baidu.com/view/ed1be61e10a6f524ccbf85fd.html建议跟pdf一起看上图是后缀数组具体怎么存储的(主要笔记就是关于倍增算法的)先看一看程序:这一段是对长度为1的字符串进行排序,论文上写的很清楚,自己划划就知道了接下来:第一句话: y[p++]=i; 想一想,此时我们考虑这个字符串i的值为8,那么也就是说i+j的r值(r[i+j])永远小于0-8中的任何数!那么毫无疑问这个y值是最小的,所以可以直接排在前面对于y数组的理解,我是这么想的:y[i]表示排名为i的 阅读全文
posted @ 2013-03-08 20:34 cssystem 阅读(1788) 评论(0) 推荐(0) 编辑