码迷,mamicode.com
首页 >  
搜索关键字:pascals triangle    ( 1342个结果
【c++程序】函数指针
#include #include using namespace std; float (*fp)(float&,float&); void (*p)(float &,float &); float triangle(float &x,float &y) { return x*y*0.5; } float rectangle(float &x,float &y) { return x*y; ...
分类:编程语言   时间:2015-01-29 17:44:42    阅读次数:303
欧拉计划(python) problem 18
Maximum path sum I Problem 18 By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23. 3 7 4 2 4 6 8 5 9 ...
分类:编程语言   时间:2015-01-29 14:38:58    阅读次数:330
LeetCode119——Pascal's Triangle II
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? 题目大意 给定一个索引k,...
分类:其他好文   时间:2015-01-27 18:21:38    阅读次数:172
Pascal's Triangle
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-01-26 22:24:35    阅读次数:273
Pascal's Triangle II
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
leetcode 【 Triangle 】python 实现
题目: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 等段时间再扯pascal triangle~ 先把一年多以前打印杨辉三角形的方法贴出来(简直不认直视,越来越不敢看以前自己写的东东了) C语言实现: /*************************************************************** Code writer...
分类:其他好文   时间:2015-01-24 17:26:45    阅读次数:156
Triangle(dp)
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
UVA 11401【数三角形】Triangle Counting------2015年1月24日
1.题意描述给定边长为1,2,3,····n的n条边,现在要在里面任意选取三条边构成三角形,我们需要求一共可以构成多少个三角形?2.题目分析首先我们分析数据大小问题,由于数据最大可以达到10^6。所以我们如果直接枚举时间复杂度可以达到O(n^3),那么我们可以肯定的说这个时间复杂度肯定是不能承受的。...
分类:其他好文   时间:2015-01-24 14:16:25    阅读次数:180
UVa 11401 Triangle Counting
题意是说在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
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!