码迷,mamicode.com
首页 >  
搜索关键字:max sum plus plus    ( 46271个结果
HDU 1231
求最大连续子序列一开始想到的一种O(n^2)的算法,应该会超时运用动态规划的思想,想出了下面的方法#include using namespace std;struct DP{ int sum,sta,end; void init(int su,int st,int en){ sum=su; sta...
分类:其他好文   时间:2014-07-19 18:04:36    阅读次数:230
php各种验证类
= $min) ? true : false;break;case 2: //只匹配最大值return ($max >= $len) ? true : false;break;default: //min = 1000 && $timeArr[0] = 0 && $dateArr[1] = 0 &&...
分类:Web程序   时间:2014-07-19 17:07:29    阅读次数:286
18位身份证号验证及信息获取
止乎于分享!IDCode18 = { validate: function (value) { if (value.length != 18) return false; var value = value.toLowerCase(); var sum...
分类:其他好文   时间:2014-07-19 16:24:38    阅读次数:230
ProgressBar学习笔记,自定义横向进度条的样式(包含ActionBar上面的进度条)
点显示进度条后→ android:max="100" 进度条的最大值 android:progress 进度条已经完成的进度值 android:progressDrawable 已经完成的进度条轨道显示的Drawable对象in...
分类:其他好文   时间:2014-07-19 15:23:13    阅读次数:393
LeetCode Maximum Subarray
class Solution {public: int maxSubArray(int A[], int n) { int cur_sum = 0; int max_sum = INT_MIN; for (int i=0; i max_...
分类:其他好文   时间:2014-07-19 15:18:15    阅读次数:160
【leetcode刷题笔记】Sum Root to Leaf Numbers
Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2->3which rep...
分类:其他好文   时间:2014-07-18 20:09:38    阅读次数:433
[再做01背包] POJ 3624 Charm Bracelet
接触动态规划的第一题是数塔问题,第二题就是01背包问题了。当时看的懵懵懂懂,回过头来再看这道题还是非常简单的了。用 dp[i][j] 表示取前i种物品,使它们总体积不超过j的最优取法取得的价值总和状态转移方程:dp[i][j] = max(dp[i-1][j],dp[i-1][j-cost[i]]+...
分类:其他好文   时间:2014-07-18 19:00:42    阅读次数:266
Collection类学习笔记
binarySearch原理: public static index halfSearch(List list, String key) { int max,min,mid; max = list.size()-1; min = 0; while(min>1; String str = list....
分类:其他好文   时间:2014-07-18 18:32:20    阅读次数:238
【leetcode刷题笔记】Path Sum
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Fo...
分类:其他好文   时间:2014-07-18 18:28:44    阅读次数:231
HDU 3047 Zjnu Stadium 带权并查集
题目来源:HDU 3047 Zjnu Stadium 题意:给你一些人 然后每次输入a b c 表示b在距离a的右边c处 求有多少个矛盾的情况  思路:用sum[a] 代表a点距离根的距离 每次合并时如果根一样 判断sum数组是否符合情况 根不一样 合并两棵树 这里就是带权并查集的精髓 sum[y] = sum[a]-sum[b]+x 这里y的没有合并前b的根  #include #in...
分类:其他好文   时间:2014-07-18 18:06:11    阅读次数:264
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!