The Triangle http://poj.org/problem?id=1163暴力dfs的话,每个节点有两条路可以走,那么n个节点复杂度就是2^n n=100 超时 dp来做 就优化成 n^2记忆化搜索,就能优化成n^2 因为一个点最多算一次,以后会直接返回dp i j 。 dp i j ....
分类:
其他好文 时间:
2014-09-14 11:19:27
阅读次数:
185
有个以坐标原点为圆心的圆,给出圆上的点的关于x轴的夹角,以及圆的半径,求圆上点所能构成的三角形的面积和
我的做法:
先算出每个点的坐标,枚举所有三个点的组合,叉积求面积
我的代码:
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
usi...
分类:
其他好文 时间:
2014-09-12 22:12:14
阅读次数:
235
Morley’s
Theorem
Input: Standard Input
Output: Standard Output
Morley’s theorem states that that the lines trisecting the angles of an arbitrary plane triangle meet at the vertices of an equilat...
分类:
其他好文 时间:
2014-09-12 15:07:13
阅读次数:
184
Triangle
Total Accepted: 17536 Total
Submissions: 65508My Submissions
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row...
分类:
其他好文 时间:
2014-09-11 07:42:01
阅读次数:
194
1 public class Solution { 2 public List getRow(int rowIndex) { 3 List result = new ArrayList(); 4 for (int i=0; i=0; j--) { 6 ...
分类:
其他好文 时间:
2014-09-10 21:02:51
阅读次数:
180
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 onlyO(...
分类:
其他好文 时间:
2014-09-09 15:07:48
阅读次数:
167
[leetcode]Pascal's Triangle II...
分类:
其他好文 时间:
2014-09-09 12:45:05
阅读次数:
118