摘要: The Triangle时间限制:1000 ms | 内存限制:65535 KB难度:4描述73 88 1 02 7 4 44 5 2 6 5(Figure 1)Figure 1 shows a number triangle. Write a program that calculates the highest sum of numbers passed on a route that starts at the top and ends somewhere on the base. Each step can go either diagonally down to the left o 阅读全文
posted @ 2012-04-14 00:50 mtry 阅读(333) 评论(0) 推荐(0)
摘要: 单调递增最长子序列时间限制:3000 ms | 内存限制:65535 KB难度:4描述求一个字符串的最长递增子序列的长度如:dabdbf最长递增子序列就是abdf,长度为4输入第一行一个整数0<n<20,表示有n个字符串要处理随后的n行,每行有一个字符串,该字符串的长度不会超过10000输出输出字符串的最长递增子序列的长度样例输入3aaaababcabklmncdefg样例输出137分析:方法一:求最大字段和的方法相似。O(n^2)dp[i] 以 i 结尾的当然也包括i 在内的最长递增子序列;我经常犯的的一个错误是:dp[i] = d[j] +1(j<i && 阅读全文
posted @ 2012-04-14 00:24 mtry 阅读(2530) 评论(0) 推荐(2)