ACM
文章平均质量分 73
kangnichaluo
可以放慢脚步,绝不停止前进!
展开
-
动态规划之Palindrome
题目:DescriptionA palindrome is a symmetrical string, that is, a string read identically from left to right as well as from right to left. You are to write a program which, given a string, det原创 2016-04-03 14:20:17 · 268 阅读 · 0 评论 -
UmBasketella
In recent days, people always design new things with multifunction. For instance, you can not only use cell phone to call your friends, but you can also use your cell phone take photographs or listen原创 2016-10-07 14:41:21 · 352 阅读 · 0 评论 -
最长上升子序列
最长不下降子序列:普通的动态规划就是以f[i]表示第I个作为序列尾数的最长序列长度。然后确定状态转移方程,如果前I-1个有小于第I个数的数a[j],找出其中最大的那个数,然后f[I]=f[j]+1,否则f[i]=1。这样由于序列是无序的,时间复杂度为O(n*2).改进算法就是把无序变成有序的,建一个数组A,使得A[len]=a[j],表示长度为len的上升子序列的最小末尾数。由于一旦l原创 2016-10-07 00:43:03 · 174 阅读 · 0 评论 -
水题
Panda has received an assignment of painting a line of blocks. Since Panda is such an intelligent boy, he starts to think of a math problem of painting. Suppose there are N blocks in a line and each原创 2016-10-07 13:46:09 · 166 阅读 · 0 评论 -
Ant counting
Bessie was poking around the ant hill one day watching the ants march to and fro while gathering food. She realized that many of the ants were siblings, indistinguishable from one another. She also re原创 2016-04-13 23:41:56 · 323 阅读 · 0 评论 -
Pass-Muraille
DescriptionIn modern day magic shows, passing through walls is very popular in which a magician performer passes through several walls in a predesigned stage show. The wall-passer (Pass-Muraille)原创 2016-04-10 12:09:18 · 608 阅读 · 0 评论 -
Little Zu Chongzhi's Triangles
Zu Chongzhi (429�500) was a prominent Chinese mathematician and astronomer during the Liu Song and Southern Qi Dynasties. Zu calculated the value ofπ to the precision of six decimal places and for a t原创 2016-04-09 19:17:36 · 248 阅读 · 0 评论 -
BUY LOW, BUY LOWER
DescriptionThe advice to "buy low" is half the formula to success in the bovine stock market.To be considered a great investor you must also follow this problems' advice: "B原创 2016-04-09 11:58:51 · 230 阅读 · 0 评论 -
简单的动态规划 Max Sum
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 = 1原创 2016-04-09 11:17:21 · 228 阅读 · 0 评论 -
Sum of Different Primes
DescriptionA positive integer may be expressed as a sum of different prime numbers (primes), in one way or another. Given two positive integersn and k, you should count the number of ways to e原创 2016-04-08 23:29:00 · 512 阅读 · 0 评论 -
区间dp
石子合并问题:在一个操场上摆放着一行共n堆的石子。现要将石子有序地合并成一堆。规定每次只能选相邻的两堆合并成新的一堆,并将新的一堆石子数记为该次合并的得分。请编辑计算出将n堆石子合并成一堆的最小得分和将n堆石子合并成一堆的最大得分。题目中要求的是只能选相邻的,区间dp;如果是任意两堆直接贪心即可。一堆石子总是由两堆石子合并而成,哪两堆?-----枚举,区间动规(类似矩阵练成等等...)原创 2016-04-05 20:53:05 · 310 阅读 · 0 评论 -
动态规划之Edit Step Ladders
题目:An edit step is a transformation from one word x to another word y such that x and y are words in the dictionary, and x can be transformed to y by adding, deleting, or changing one letter. So the原创 2016-04-05 07:24:08 · 403 阅读 · 0 评论 -
动态规划之To the Max
题目:DescriptionGiven a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1*1 or greater located within the whole array. The sum of a原创 2016-04-03 14:59:16 · 334 阅读 · 0 评论 -
记忆化搜索之Longest Run on a Snowboard
记忆化搜索!!!题目:Michael likes snowboarding. That's not very surprising, since snowboarding is really great. The bad thing is that in order to gain speed, the area must slide downwards. Another disadv原创 2016-04-03 14:43:54 · 222 阅读 · 0 评论 -
动态规划之Charm Bracelet
题目:DescriptionBessie has gone to the mall's jewelry store and spies a charm bracelet. Of course, she'd like to fill it with the best charms possible from theN (1 ≤ N ≤ 3,402) available原创 2016-04-03 14:39:05 · 864 阅读 · 0 评论 -
动态规划之Multiplication Puzzle
题目:DescriptionThe multiplication puzzle is played with a row of cards, each containing a single positive integer. During the move player takes one card out of the row and scores the number o原创 2016-04-03 14:31:43 · 396 阅读 · 0 评论 -
Subimage Recognition
An image A is said to be a subimage of another image B if it is possible to remove some rows and/or columns of pixels from B so that the resulting image is identical to A. Figure 6 illustrates原创 2016-10-07 15:23:35 · 286 阅读 · 2 评论