码迷,mamicode.com
首页 >  
搜索关键字:minimum sum lcm    ( 24851个结果
UVA 1484 - Alice and Bob's Trip(树形DP)
题目链接:1484 - Alice and Bob's Trip 题意:BOB和ALICE这对狗男女在一颗树上走,BOB先走,BOB要尽量使得总路径权和大,ALICE要小,但是有个条件,就是路径权值总和必须在[L,R]之间,求最终这条路径的权值。 思路:树形dp,dp[u]表示在u结点的权值,往下dfs的时候顺带记录下到根节点的权值总和,然后如果dp[v] + w + sum 在[l,r]内,...
分类:其他好文   时间:2014-07-22 23:05:33    阅读次数:486
[leetcode] Minimum Path Sum
思路很简单,就是存储之前运算的结果,然后递归class Solution {public: int** dp; int get_min_sum(vector > &grid, int m, int n) { if (dp[m][n] != -1) ...
分类:其他好文   时间:2014-05-01 07:54:47    阅读次数:330
[ACM] hdu 1003 Max Sum(最大子段和模型)
Max Sum Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 135262    Accepted Submission(s): 31311 Problem Description   Given a sequen...
分类:其他好文   时间:2014-04-30 22:21:40    阅读次数:280
c语言参数传递方式
今天在写栈碰到 了一个问题关于c语言参数传递的让我郁闷了半天 我只发现了两个问题一个 实参sum(a,b) 形参sum(int a,int b)或者sum(int &a,int &b) 实参sum(&a,&b) 形参sum(int *a,int *b) 这个就是c函数传地址与传引用传值!...
分类:编程语言   时间:2014-04-29 13:38:21    阅读次数:271
NYOJ 215 Sum
NYOJ 215 Sum...
分类:其他好文   时间:2014-04-29 13:25:20    阅读次数:192
数组求和的快速方法(利用cuda的共享内存)--第一部分之源码分析
代码来自于这里 https://code.google.com/p/stanford-cs193g-sp2010/source/browse/trunk/tutorials/sum_reduction.cu...
分类:其他好文   时间:2014-04-29 13:13:20    阅读次数:324
Leetcode:Add Binary 二进制相加
Given two binary strings, return their sum (also a binary string). For example, a = "11" b = "1" Return "100". 思路同十进制的大数相加。代码如下: class Solution { public: string addBinary(string a, str...
分类:其他好文   时间:2014-04-29 13:12:20    阅读次数:328
UVA 618 - Doing Windows(数论)
题目链接:618 - Doing Windows 题意:给定一个大小不能变的屏幕,和四个大小可以变的窗口,变化要保持长宽比,问这四个窗口能不能调整后全部放下正好填满屏幕,不能重叠 思路:情况一共就几种:4个叠一起,3个叠一起+一个,2个和2个,一个和两个叠一起在一个,把这几种情况全判断了就可以了,判断过程利用gcd,lcm可以求边长。 代码: #include #include lo...
分类:Windows程序   时间:2014-04-29 13:12:20    阅读次数:617
Leetcode:Minimum Path Sum 最小路径和
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. Note: You can only move either down or right at...
分类:其他好文   时间:2014-04-28 10:46:41    阅读次数:311
C++ - Vector 计算 均值(mean) 和 方差(variance)
Vector 计算 均值(mean) 和 方差(variance) 本文地址: http://blog.csdn.net/caroline_wendy vector的数组, 计算均值和方差的最简方法. 代码: double sum = std::accumulate(std::begin(resultSet), std::end(resultSet), 0.0);...
分类:编程语言   时间:2014-04-28 10:44:42    阅读次数:587
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!