Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the fol...
分类:
其他好文 时间:
2014-08-15 23:47:19
阅读次数:
302
Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6...
分类:
其他好文 时间:
2014-08-14 23:50:36
阅读次数:
270
Given an index k, return the kth row of the Pascal's triangle.For example, given k = 3,Return [1,3,3,1].Note:Could you optimize your algorithm to use ...
分类:
其他好文 时间:
2014-08-14 23:44:26
阅读次数:
323
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the fol...
分类:
其他好文 时间:
2014-08-14 23:26:46
阅读次数:
219
题意:输入一个n层的三角形,第i层有i个数,求从第1层到第n层的所有路线中,权值之和最大的路线。
规定:第i层的某个数只能连线走到第i+1层中与它位置相邻的两个数中的一个。
状态方程:f[i][j]=max(f[i-1][j-1],f[i-1][j])+a[i][j];...
分类:
其他好文 时间:
2014-08-13 18:50:27
阅读次数:
166
链接:http://vjudge.net/problem/viewProblem.action?id=47586
题意:给一个字符串,可以将从前数第i~j和从后数第i~j字符串看作一个字符,问整段字符串看作一个回文里有多少个字符。
思路:字符串哈希,从前开始哈希也从后开始哈希,遇到哈希值相同就多两个字符,最后处理一下中间的字符即可。
代码:#include
#include
#inclu...
分类:
其他好文 时间:
2014-08-11 21:36:42
阅读次数:
255
/** * 使用多重循环打印6阶杨辉三角*/public class YangHui { public static void main(String[] args){ int[][] triangle=new int[6][6]; int i,j,k=0; for(i=0;i<tria...
分类:
其他好文 时间:
2014-08-09 22:56:29
阅读次数:
263
The Angles of a TriangleYou are given the lengths for each side on a triangle. You need to find all three angles for this triangle. If the given side ...
分类:
其他好文 时间:
2014-08-08 18:04:36
阅读次数:
234
1. 值参数 将参数以值的形式传递是默认的传递方式一个参数以值的形式传递意味着创建这个变量的本地副本,过程和函数对副本进行运算,看下面的例子:当用这种方法调用一个过程时,一个字符串的副本就被创建,Foo()将对副本s进行运算,这表示对这个副本的任何修改都不会影响到原来的变量。2. 引用参数 Pas....
分类:
其他好文 时间:
2014-08-08 01:50:15
阅读次数:
199
基本安装 1、对于单个控件,Componet-->install component..-->PAS或DCU文件-->install; 2、对于带*.dpk文件的控件包,File-->Open(下拉列表框中选*.dpk)-->install即可; 3、对于带*.bpl文件的控件包,Install.....
分类:
其他好文 时间:
2014-08-08 01:45:25
阅读次数:
240