码迷,mamicode.com
首页 >  
搜索关键字:pascals triangle    ( 1342个结果
Project Euler:Problem 61 Cyclical figurate numbers
Triangle, square, pentagonal, hexagonal, heptagonal, and octagonal numbers are all figurate (polygonal) numbers and are generated by the following formulae: Triangle   P3,n=n(n+1)/2   1, 3,...
分类:其他好文   时间:2015-07-14 18:23:07    阅读次数:83
[LeetCode] Pascal's Triangle
Question:GivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1...
分类:其他好文   时间:2015-07-14 13:01:50    阅读次数:130
120 Triangle
题目:120 Triangle这道题纯dp, 但是有一个比一下代码优化的做法,就是从底部bottomu-up dp.class Solution: # @param triangle, a list of lists of integers # @return an integer ...
分类:其他好文   时间:2015-07-14 06:04:55    阅读次数:114
LeetCode Pascal's Triangle II (杨辉三角)
题意:给出杨辉三角的层数k,返回最后一层。k=0时就是只有一个数字1。思路:滚动数组计算前一半出来,返回时再复制另一半。简单但是每一句都挺长的。 1 class Solution { 2 public: 3 vector getRow(int rowIndex) { 4 if...
分类:其他好文   时间:2015-07-11 16:35:18    阅读次数:138
UVa 11437 - Triangle Fun
了解矢量为交点的坐标。#include #include #include #include #include #include #define eqs 1e-8using namespace std;double a = 2.0/3;double b = 1.0/3;int main(){ ...
分类:其他好文   时间:2015-07-06 10:06:11    阅读次数:108
The Triangle
描述 7 3 8 8 1 0 2 7 4 4 4 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 some...
分类:其他好文   时间:2015-07-05 12:26:39    阅读次数:92
[Leetcode]-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?Hide Tags : Array 题目:返回帕...
分类:其他好文   时间:2015-07-04 15:36:11    阅读次数:119
[Leetcode]-Pascal's Triangle
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] ]题目:根据numRows生成帕斯卡三角形。帕...
分类:其他好文   时间:2015-07-03 20:46:45    阅读次数:137
Pascal's Triangle II
题目: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-07-03 15:26:28    阅读次数:89
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...
分类:其他好文   时间:2015-07-03 11:53:11    阅读次数:93
1342条   上一页 1 ... 78 79 80 81 82 ... 135 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!