Given an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[1,3,3,1].完成Pascal's Triangle问题,这个就不难了吧~ 1 public class Soluti...
分类:
其他好文 时间:
2015-01-26 22:19:34
阅读次数:
191
一、设置——>首选项 添加pas二、运行,在输入框中填入命令:cmd /k cd /d "$(CURRENT_DIRECTORY)" &fpc -g $(FILE_NAME) &pause &exit 设置快捷键F9 ,名字 Compile。三、运行,在输入框中填入命令:cmd /k cd /d ....
分类:
其他好文 时间:
2015-01-26 22:18:27
阅读次数:
424
题目: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 ...
分类:
编程语言 时间:
2015-01-26 20:42:03
阅读次数:
180
Pascal triangle
等段时间再扯pascal triangle~
先把一年多以前打印杨辉三角形的方法贴出来(简直不认直视,越来越不敢看以前自己写的东东了)
C语言实现:
/***************************************************************
Code writer...
分类:
其他好文 时间:
2015-01-24 17:26:45
阅读次数:
156
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-01-24 14:24:02
阅读次数:
180
1.题意描述给定边长为1,2,3,····n的n条边,现在要在里面任意选取三条边构成三角形,我们需要求一共可以构成多少个三角形?2.题目分析首先我们分析数据大小问题,由于数据最大可以达到10^6。所以我们如果直接枚举时间复杂度可以达到O(n^3),那么我们可以肯定的说这个时间复杂度肯定是不能承受的。...
分类:
其他好文 时间:
2015-01-24 14:16:25
阅读次数:
180
题意是说在1,2,3,……,n的序列中选出前n个数。
能够组成多少种三角形。白书上的例题。
找到递归公式就好了。根据三角不等式,如果三条边为 a,b,c。最大边为c。
a+b>c。
假设a:1 -> c-1 为止,那么a=1无解,a=2有一个,a=3……,a=c-1 有c-2个解。
那么根据等差求和公式得出和。但是需要减去 a==b 的时候,从x/2+1 到 x-1 一共...
分类:
其他好文 时间:
2015-01-20 12:06:39
阅读次数:
174
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-01-19 09:18:45
阅读次数:
286
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 only O(k) extra space?
这题和前面一题的区别...
分类:
编程语言 时间:
2015-01-19 09:17:31
阅读次数:
185
题目:Given an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[1,3,3,1].Note:Could you optimize your algorithm to use onl...
分类:
编程语言 时间:
2015-01-18 22:30:51
阅读次数:
291