码迷,mamicode.com
首页 >  
搜索关键字:maximum product suba    ( 9145个结果
ThinkPHP 多表查询-如果字段A相同,则把字段B相加
在一个项目中,需要查询表tr_product中的user_id字段,如果user_id相同,则把其对应的money字段相加,数据库截图如下:实现代码:$Model = D('Model');$res =$Model->query("SELECT user_id,sum(money) from tr_...
分类:Web程序   时间:2014-07-12 13:11:17    阅读次数:287
判断两线段是否相交
今日集训第一日,遇到了判断线段相交问题。跟面积问题一样,这个同样可以用叉积来解决。数学原理证明:首先引出计算几何学中一个最基本的问题:如何判断向量在的顺时针方向还是逆时针方向?把p0定为原点,p1的坐标是(x1,y1),p2的坐标是(x2,y2)。向量的叉积(cross product)实际上就是矩...
分类:其他好文   时间:2014-07-12 00:37:19    阅读次数:406
Best Time to Buy and Sell Stock II
Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a...
分类:其他好文   时间:2014-07-09 23:32:44    阅读次数:276
linq 之 Distinct的使用
1 public class Product 2 { 3 public string Name { get;set;} 4 public int Code { get; set; } 5 } 6 ...
分类:其他好文   时间:2014-07-09 17:39:41    阅读次数:182
简单工厂模式(simple factory pattern)
简单工厂模式是由一个工厂对象来决定创建出哪一种产品类的实例(对象),就是由一个工厂类根据传入的参数来决定需要创建哪一种产品的对象或实例。 此模式主要涉及到工厂角色,抽象产品,具体产品三个角色 工厂类(Creator),此模式的核心,含有与应用紧密相关的商业逻辑, 抽象产品(Product),担任需要创建产品的父类,一般由一个java接口事抽象类来实现 具体产品(Concrete Produ...
分类:其他好文   时间:2014-07-09 12:18:01    阅读次数:187
如何将Oracle安装为Linux服务
方法一:使用oracle自带的启动和关闭脚本1. oracle用户修改/etc/oratab 文件:$vi/etc/oratab orcl:/oracle/app/product/10.2.0/db_1:N改为:orcl:/oracle/app/product/10.2.0/db_1:Y也就是将最后...
分类:数据库   时间:2014-07-08 23:28:00    阅读次数:377
[leetcode] Max Points on a Line
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.
分类:其他好文   时间:2014-07-08 00:41:49    阅读次数:235
[Leetcode][Tree][Binary Tree Maximum Path Sum]
找书中权值和最大的路径,至少包含一个点。有点类似LCA(最近公共祖先),树的问题关键是如何划分子问题,然后递归求解。想到了可以返回两种结果,一个是单独路径的最大和,一种是子树的最大和,然后在求解的过程中不断的更新答案。 1 /** 2 * Definition for binary tree 3 ....
分类:其他好文   时间:2014-07-06 14:16:47    阅读次数:187
LeetCode——Longest Palindromic Substring
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring. 给定一个字符串S,找出其中的最长回文...
分类:其他好文   时间:2014-07-06 00:15:15    阅读次数:240
POJ 3693 Maximum repetition substring (后缀数组)
题目大意: 求出字典序最小,重复次数最多,的子串。 思路分析: RMQ + height 数组可以求出任意两个后缀的lcp 我们枚举答案字符串的重复的长度。 如果这个字符串的长度为 l ,而且这个字符串出现过两次或两次以上 那么你会发现在原串中  str[0] str[l] str[2*l] ....肯定有相邻的两个被包含在重复的串中。 我们求出这两个相邻的后缀的lcp 我...
分类:其他好文   时间:2014-07-05 23:47:48    阅读次数:178
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!