题 题意 求1到n长度的n根棍子(3≤n≤1000000)能组成多少不同三角形。 分析 我看大家的递推公式都是 a[i]=a[i-1]+ ((i-1)*(i-2)/2-(i-1)/2)/2; 因为以最大长度i 为最大边的三角形有 第二边为i-1、i-2、...2 分别有 i-2个、i-3、... 、
分类:
其他好文 时间:
2016-02-18 06:32:24
阅读次数:
157
直接上代码,不多说了! 画三角形 1)、 <style type="text/css"> .triangle{ width: 0; height: 0; /*border: 50px transparent solid;*//*当没有这句时,至少有2个方向的边框才能成形,比如下面的一组*/ bord
分类:
Web程序 时间:
2016-02-15 12:12:58
阅读次数:
271
The Triangle Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 42547 Accepted: 25721 Description 73 88 1 02 7 4 44 5 2 6 5(Figure 1) Figure 1
分类:
其他好文 时间:
2016-02-09 19:59:10
阅读次数:
221
Triangle Time Limit: 3000MS Memory Limit: 30000K Total Submissions: 8917 Accepted: 2650 Description Given n distinct points on a plane, your task is t
分类:
其他好文 时间:
2016-02-06 01:39:34
阅读次数:
241
题目:给定一个行索引index,返回帕斯卡三角形第index层的三角形 算法:生成index层帕斯卡三角形,并返回第index层三角形 public class Solution { public List<Integer> getRow(int rowIndex) { if (rowIndex <
分类:
其他好文 时间:
2016-01-30 13:37:24
阅读次数:
110
给出一个数字n,计算从1到n能组成几个不同的三角形。 n的范围是10^6,大概就是递推吧。从F[i-1]到F[i]可以线性求出。要注意结果超出int。 #include <cstdio> #include <cstring> #include <algorithm> using namespace
分类:
其他好文 时间:
2016-01-30 02:29:40
阅读次数:
156
题目描述: Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Return [1,3,3,1]. 解题思路: 每次在上一个list前面插入1,然后后面的每两个间相加赋值给前一
分类:
编程语言 时间:
2016-01-27 22:55:09
阅读次数:
226
问题描述: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...
分类:
编程语言 时间:
2016-01-27 12:43:16
阅读次数:
149
.triangle{display: block;height: 0;position: absolute;width: 0;border: 9px solid;border-color: transparent #bbb;border-right-width: 0;}
分类:
Web程序 时间:
2016-01-25 14:28:50
阅读次数:
169
翻译给定一个索引K,返回帕斯卡三角形的第K行。例如,给定K=3,
返回[1,3,3,1]。注释:
你可以改进你的算法只用O(k)的额外空间吗?原文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 optimiz...
分类:
其他好文 时间:
2016-01-23 13:16:29
阅读次数:
186