摘要:
题目:一个人的旅行Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 14871Accepted Submission(s): 5038Problem Description虽然草儿是个路痴(就是在杭电待了一年多,居然还会在校园里迷路的人,汗~),但是草儿仍然很喜欢旅行,因为在旅途中 会遇见很多人(白马王子,^0^),很多事,还能丰富自己的阅历,还可以看美丽的风景……草儿想去很多地方,她想要去东京铁塔看夜景,去威尼斯看电影,去阳明山上看海芋,... 阅读全文
摘要:
题目:Minimum Transport CostTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6044Accepted Submission(s): 1527Problem DescriptionThese are N cities in Spring country. Between each pair of cities there may be one transportation track or none. Now there i 阅读全文
摘要:
题目:ArbitrageTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3443Accepted Submission(s): 1562Problem DescriptionArbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of the same 阅读全文
摘要:
题目:统计难题Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 131070/65535 K (Java/Others)Total Submission(s): 14095Accepted Submission(s): 6070Problem DescriptionIgnatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀).Input输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignati 阅读全文
摘要:
出处:http://www.cnblogs.com/wuyiqi/archive/2012/01/06/2314078.html kmp next函数 kmp的周期问题,深入了解kmp中next的原理----------------------------------------------k m x j i由上,next【i】=j,两段红色的字符串相等(两个字符串完全相等),s[k....j]==s[m....i]设s[x...j]=s[j....i](xj=ji)则可得,以下简写字符串表达方式kj=kx+xj;mi=mj+ji;因为xj=ji,所以kx=mj,如下图... 阅读全文
摘要:
题目:Cyclic NacklaceTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1892Accepted Submission(s): 830Problem DescriptionCC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, there are 阅读全文
摘要:
题目: You've been invited to a party. The host wants to divide the guests into 2 teams for party games, with exactly the same number of guests on each team. She wants to be able to tell which guest is on which team as she greets them when they arrive. She'd like to do so as easily as possible, 阅读全文
摘要:
先上题目:Number SequenceTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8442Accepted Submission(s): 3858Problem DescriptionGiven two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[M] (1 2 #include 3 #define MAX 1000010 .. 阅读全文
摘要:
先上题目:SumTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 206Accepted Submission(s): 113Problem DescriptionSample Input2Sample Output2Hint1. For N = 2, S(1) = S(2) = 1.2. The input file consists of multiple test cases. 2013多校第十场的其中一题,题意就是根据他给的公... 阅读全文
摘要:
先上题目:PeriodTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2061Accepted Submission(s): 1016Problem DescriptionFor each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to know wh 阅读全文
摘要:
出处:http://www.cppblog.com/oosky/archive/2006/07/06/9486.htmlKMP字符串模式匹配详解来自CSDN A_B_C_ABC网友KMP字符串模式匹配通俗点说就是一种在一个字符串中定位另一个串的高效算法。简单匹配算法的时间复杂度为O(m*n);KMP匹配算法。可以证明它的时间复杂度为O(m+n).。一.简单匹配算法先来看一个简单匹配算法的函数: 1 int Index_BF ( char S [ ], char T [ ], int pos ) 2 3 { 4 5 /* 若串 S 中从第pos(S 的下标0≤posS[0]!= S[1]... 阅读全文
摘要:
出处:http://www.cnblogs.com/dolphin0520/archive/2011/08/24/2151846.htmlKMP算法在介绍KMP算法之前,先介绍一下BF算法。一.BF算法 BF算法是普通的模式匹配算法,BF算法的思想就是将目标串S的第一个字符与模式串P的第一个字符进行匹配,若相等,则继续比较S的第二个字符和P的第二个字符;若不相等,则比较S的第二个字符和P的第一个字符,依次比较下去,直到得出最后的匹配结果。 举例说明:S: ababcababaP:ababa BF算法匹配的步骤如下 i=0 i=1 ... 阅读全文
摘要:
先上题目:Digital RootsTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 39890Accepted Submission(s): 12286Problem DescriptionThe digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit th 阅读全文
摘要:
先上题目:YAPTCHATime Limit: 10000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 463Accepted Submission(s): 280Problem DescriptionThe math department has been having problems lately. Due to immense amount of unsolicited automated programs which were crawling across th 阅读全文
摘要:
题目:A + B Problem IITime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 167825Accepted Submission(s): 32125Problem DescriptionI have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B.InputThe first line 阅读全文
摘要:
出处:http://hi.baidu.com/czyuan_acm/item/81b21d1910ea729c99ce33db三分法——求解凸性函数的极值问题——czyuan原创 二分法作为分治中最常见的方法,适用于单调函数,逼近求解某点的值。但当函数是凸性函数时,二分法就无法适用,这时三分法就可以“大显身手”~~ 如图,类似二分的定义Left和Right,mid = (Left + Right) / 2,midmid = (mid + Right) / 2; 如果mid靠近极值点,则Right = midmid;否则(即midmid靠近极值点),则Left = mid;程序模... 阅读全文
摘要:
先上题目Dome of CircusTime Limit: 10000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 931Accepted Submission(s): 417Special JudgeProblem DescriptionA travelling circus faces a tough challenge in designing the dome for its performances. The circus has a number of show 阅读全文
摘要:
上题目Problem C - You can say 11Time Limite: 1 secondIntroduction to the problemYour job is, given a positive number N, determine if it is a multiple of eleven.Description of the inputThe input is a file such that each line contains a positive number. A line containing the number 0 is the end of the in 阅读全文
摘要:
先上题目PartitionTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1697Accepted Submission(s): 688Problem DescriptionDefine f(n) as the number of ways to perform n in format of the sum of some positive integers. For instance, when n=4, we have4=1+1+1+14= 阅读全文
摘要:
先上题目Jumping CowsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 6453Accepted: 3859DescriptionFarmer John's cows would like to jump over the moon, just like the cows in their favorite nursery rhyme. Unfortunately, cows can not jump. The local witch doctor has mixed up P (1 #include #incl 阅读全文
摘要:
先上题目I'm Telling the TruthTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1013Accepted Submission(s): 498Problem DescriptionAfter this year’s college-entrance exam, the teacher did a survey in his class on students’ score. There are n students i 阅读全文
摘要:
先上题目Selecting CoursesTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 7781Accepted: 3444DescriptionIt is well known that it is not easy to select courses in the college, for there is usually conflict among the time of the courses. Li Ming is a student who loves study every much, and at the b 阅读全文
摘要:
先上题目Prime PathTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 9259Accepted: 5274DescriptionThe ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices. — It is a matter of sec 阅读全文
摘要:
先上题目k-Multiple Free Settime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA k-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by k. That is, there are no two integers x and y 阅读全文
摘要:
先上题目:Holedox EatingTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2793Accepted Submission(s): 919Problem DescriptionHoledox is a small animal which can be considered as one point. It lives in a straight pipe whose length is L. Holedox can only mov 阅读全文
摘要:
先上题目HeroTime Limit: 6000/3000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2131Accepted Submission(s): 960Problem DescriptionWhen playing DotA with god-like rivals and pig-like team members, you have to face an embarrassing situation: All your teammates are killed, a 阅读全文
摘要:
之前看过,可是当时没有细看,今天在网上搜了一下,看了一下别人的思路,毕竟这也是一类问题的经典。过一段时间再将自己对其认识总结。现在先转载别人的思路。 出处:http://blog.csdn.net/sd6264456/article/details/9318861 给n个点的坐标,求距离最近的一对点之间距离的一半。第一行是一个数n表示有n个点,接下来n行是n个点的x坐标和y坐标,实数。 这个题目其实就是求最近点对的距离。主要思想就是分治。先把n个点按x坐标排序,然后求左边n/2个和右边n/2个的最近距离,最后合并。合并要重点说一下,比较麻烦。 首先,假设点是n个,编号为1到n。我们要分... 阅读全文
摘要:
先上题目1054 - Efficient Pseudo Code PDF (English) Statistics Forum Time Limit: 1 second(s)Memory Limit: 32 MBSometimes it's quite useful to write pseudo codes for problems. Actually you can write the necessary steps to solve a particular problem. In this problem you are given a pseudo code to solve 阅读全文
摘要:
先上题目Problem APlay with Floor and CeilInput: standard inputOutput: standard outputTime Limit: 1 secondTheoremFor any two integers x and k there exists two more integers p and q such that:It’s a fairly easy task to provethis theorem, so we’d not ask you to do that. We’d ask for something eveneasier! G 阅读全文
摘要:
先上题目青蛙的约会Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 81279Accepted: 14010Description两 只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它 们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去, 总能碰到对方的。但是除非这两只青蛙在同一时间跳到同一点上,不然是永远都不可能碰面的。为了帮助这两只乐观的青蛙, 阅读全文