Problem Description: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...
分类:
其他好文 时间:
2014-07-07 16:05:24
阅读次数:
229
Problem Description: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...
分类:
其他好文 时间:
2014-07-07 15:24:41
阅读次数:
212
Problem Description:Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most...
分类:
其他好文 时间:
2014-07-07 15:24:05
阅读次数:
206
题目:
链接:
题意:
思路:
代码:
#include
#include
#include
using namespace std;
const int N = 30030;
int root[N];
int sum[N],rank[N];//sum[i]表示i下面的积木个数
int q;
int findset(int x)
{
if(x == r...
分类:
其他好文 时间:
2014-07-01 08:12:55
阅读次数:
178
通过做这题,发现了自己的问题很大,做题不是贴代码,而是要了解思想;这题考的是有一个起点的集合,求起点集合到一个终点的最短距离,本来想用Floy的但一看map[1000][1000]超时,有向图,逆序建邻接矩阵,这样就成了一个终点到所有点的最短路了。 1 #include 2 #include ...
分类:
其他好文 时间:
2014-06-29 18:40:11
阅读次数:
170
题意:给你两个字符串,求最长公共字串的长度。
by:罗穗骞模板
#include
#include
#include
#include
using namespace std;
#define M 303
#define inf 0x3fffffff
#define maxn 500000
#define ws ww
#define rank RANK
#define F(x)...
分类:
其他好文 时间:
2014-06-28 08:00:24
阅读次数:
190
需要注意的是,可以操作两次买卖,但是第二次买入必须在第一次卖出之后才能操作。所以思路就是先正序使用贪心计算每一天之前买入卖出可能达到的最大收益,拿数组记录下来。再逆序计算每一天对应的之后买入卖出可能达到的最大收益,拿数组记录下来。然后将两个数组中每一天对应的两种情况可以实现的收益之和,得到最大值即为可以实现的最大收益。code如下:...
分类:
其他好文 时间:
2014-06-27 23:44:49
阅读次数:
247
题目POJ 3617 和 这道题题目一样,只是范围稍稍再小一点。//模拟试试#include#include#includeusing namespace std;char s[30010][2];bool bijiao(int st,int ed){ if(st==ed) re...
分类:
其他好文 时间:
2014-06-26 16:00:00
阅读次数:
201
Transact-SQL提供了4个排名函数: RANK(),DENSE_RANK(),ROW_NUMBER(),NTILE(),下文是对这4个函数进行的解释。...
分类:
数据库 时间:
2014-06-26 08:01:11
阅读次数:
304
作为一个Celery使用重度用户,看到Celery Best Practices这篇文章,不由得菊花一紧。干脆翻译出来,同时也会加入我们项目中celery的实战经验。通常在使用Django的时候,你可能需要执行一些长时间的后台任务,没准你可能需要使用一些能排序的任务队列,那么Celery将会是一个非常好的选择。当把Celery作为一个任务队列用于很多项目中后,作者积累了一些最佳实践方式,譬如如何用...
分类:
其他好文 时间:
2014-06-26 07:18:06
阅读次数:
274