OJ题目 :
click here~~
题目分析:给一个数字三角形,从最上面一个数字开始,方向只能往左下或者右下,一直到最后一行,求经过的所有数字和的最大值。
搞清楚在输入的数据中,route的方向就行。
AC_CODE
int num[102][102];
int main(){
int n , i , j , k ;
while(cin >> n){
...
分类:
其他好文 时间:
2014-07-22 23:05:55
阅读次数:
372
Problem D
Predator II
Time limit: 2 seconds
Oh No!!! The predator has entered the room again. But this time it is a different kind of room.
The room is a square of size 1000...
分类:
其他好文 时间:
2014-07-22 23:03:13
阅读次数:
358
Problem Description 吉哥又想出了一个新的完美队形游戏!
假设有n个人按顺序站在他的面前,他们的身高分别是h[1], h[2] ...
h[n],吉哥希望从中挑出一些人,让这些人形成一个新的队形,新的队形若满足以下三点要求,则就是新的完美队形: 1、挑出的人保持原队形的相对顺...
分类:
其他好文 时间:
2014-05-10 19:42:07
阅读次数:
309
题目链接很简单的递推,但是写代码的过程中,犯了一个严重的错误,就是我用unsigned
int型变量>= 0 作为循环条件(而且是降序)的时候,出现了问题。附上代码: 1 class Solution { 2 public: 3 int
minimumTotal(vector > &tria...
分类:
其他好文 时间:
2014-05-06 00:10:57
阅读次数:
335
Link:http://oj.leetcode.com/problems/reverse-linked-list-ii/Reverse a linked
list from positionmton. Do it in-place and in one-pass.For example:Given1...
分类:
其他好文 时间:
2014-05-05 22:46:11
阅读次数:
411
原地址:http://digitalerr0r.wordpress.com/2013/08/27/unity-for-windows-ii-publishing-to-windows-8/Windows
8 is a new OS with a Windows Store where you can...
hdu 1165 Eddy's research II (数学题,递推)...
分类:
其他好文 时间:
2014-05-03 15:34:41
阅读次数:
215
本文出自:http://blog.csdn.net/svitter
题意:汉诺塔,多了一根柱子,问你寻找最快的移动次数。
dp [ n ] = dp [ n - j ] * 2 + pow( 2, j ) - 1;
就是把j个汉诺塔移到一根上,然后就是普通的汉诺塔问题,即2^n - 1次移动。
注意pow(2, j )可能超出long long int范围。写二的次方的时候也可用移...
分类:
其他好文 时间:
2014-05-03 00:14:10
阅读次数:
342
这道题,采用动态规划算法。from top to
down,把到每个节点的最小路径和都求出来。下面是AC代码: 1 /** 2 * Given a triangle, find the minimum path
sum from top to bottom. 3 * Each ...
分类:
其他好文 时间:
2014-05-02 12:19:23
阅读次数:
382