Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[?2,1,?3,4,?1,2,1,...
分类:
其他好文 时间:
2014-08-31 15:49:11
阅读次数:
180
UVA 11324 - The Largest Clique
题目链接
题意:给定一个有向图,要求找一个集合,使得集合内任意两点(u, v)要么u能到v,要么v能到u,问最大能选几个点
思路:强连通分量,构造出scc之后,缩点,每个点的权值是集合点个数,然后做一遍dag找出最大权值路径即可
代码:
#include
#include
#include
#incl...
分类:
其他好文 时间:
2014-08-30 13:55:39
阅读次数:
196
这篇博客的目的是为了提醒自己,以后笔试一定得及时交啊?!!!!
阿里笔试的最后一个题,我顺手就写python实现,代码如下,不知道对不对,反正当时好几个数据都过了。
不过,反正没交上去,那个题填代码的地方是空的,对错都没用了。先记下,改天细究:
def largest_common(query, text, is_first_same):
if (len(query) == 0 or...
分类:
编程语言 时间:
2014-08-29 21:26:08
阅读次数:
297
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[?2,1,?3,4,?1,2,1,...
分类:
其他好文 时间:
2014-08-29 01:18:46
阅读次数:
187
#include #include #include using namespace std;int a[100100],q[100100],l[100100],r[100100];int main(){ int i,n,cnt; while(scanf("%d",&n),n!=0) ...
分类:
其他好文 时间:
2014-08-28 22:34:16
阅读次数:
224
Description
Running a paper shop is not an easy job, especially with harsh customers. Today they brought their own rectangular sheets of paper, asking you to cut it into rectangular business cards ...
分类:
其他好文 时间:
2014-08-27 18:52:38
阅读次数:
314
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [?2,1,?3,4,?1,2,1...
分类:
其他好文 时间:
2014-08-26 22:44:46
阅读次数:
212
Corn FieldsTime Limit:2000MSMemory Limit:65536KTotal Submissions:7798Accepted:4159DescriptionFarmer John has purchased a lush new rectangular pasture ...
分类:
其他好文 时间:
2014-08-26 22:39:36
阅读次数:
236
//堆排序//①维护堆 void max_heapify(int *ptr,int index,int len){ index = index + 1; int left = index ptr[index - 1]) largest = left; if(righ...
分类:
其他好文 时间:
2014-08-26 11:19:16
阅读次数:
186
记录动态规划dpl,dpr,分辨记录i左面的比i大的,右面比i大的,然后(dpr[i]-dpl[i]+1)*h[i]得出长度
动态转移方程while(temp>1 && h[temp-1]>=h[i]) temp=dpl[temp-1]
/*************************************************************************
> F...
分类:
其他好文 时间:
2014-08-25 01:11:53
阅读次数:
248