题意:给一个用序列堆成的三角形,第n层的元素个数为n,从顶往下,每个元素可以选择与自己最近的两个下层元素往下走,类似一棵二叉树,求最短路。 [2], [3,4], [6,5,7], [4,1,8,3] 注意:这里可以2->3>5>1,也可以2->4>5->1,隔层相邻就可以走。...
分类:
其他好文 时间:
2015-07-27 12:35:27
阅读次数:
103
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,4,1]
]
解决方案:
vector> gene...
分类:
其他好文 时间:
2015-07-26 20:56:25
阅读次数:
135
class Solution {public: int minimumTotal(vector>& triangle) { int sum=0; if(triangle.size() == 0) return sum; sum = triangle[0][0]; ...
分类:
其他好文 时间:
2015-07-25 15:11:43
阅读次数:
115
题目链接:http://lightoj.com/volume_showproblem.php?problem=1043题意:一个三角形ABC,DE//BC,已知三角形ADE和四边形BDEC的面积的比,求AD的长度。解法:二分AD边即可代码:#include
#include
#include
#include
#includ...
分类:
其他好文 时间:
2015-07-23 22:02:31
阅读次数:
204
最近在网上下载了 Triangle 库,准备在程序中调用来三角化生成网格,但出现了很多错误,如下:1> triangle.c1>d:\program files\visualstudio2010\vc\include\cmath(19): error C2061: 语法错误: 标识符“acosf”1...
分类:
编程语言 时间:
2015-07-23 13:44:28
阅读次数:
142
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...
分类:
其他好文 时间:
2015-07-23 00:16:27
阅读次数:
187
Given an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[1,3,3,1].public class Solution { public List getRow(int ro...
分类:
其他好文 时间:
2015-07-22 22:39:15
阅读次数:
150
GivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]...
分类:
其他好文 时间:
2015-07-22 22:16:08
阅读次数:
105
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 following triangle
[
[2],
[3,4],
[...
分类:
其他好文 时间:
2015-07-22 20:56:27
阅读次数:
105