char s[maxn];
int sa[maxn];
int t[maxn], t2[maxn], c[maxn];
int rank[maxn], height[maxn];
int n;
void build_sa(int m)
{
int i, *x = t, *y = t2;
for(i = 0; i < m; i++)
c[i] = 0;
for(i = 0; i < n; ...
分类:
其他好文 时间:
2014-07-22 23:04:34
阅读次数:
293
这道题在前两个的基础上做稍微改进就可以。下面是AC代码: 1 /** 2 * Design an
algorithm to find the maximum profit. You may complete at most two transactions.
3 * @pa...
分类:
其他好文 时间:
2014-07-22 23:01:13
阅读次数:
251
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-05-06 00:51:29
阅读次数:
353
If you have installed YouTrack from EXE
Distribution, then the best way to change the database location is by specifying
it via JVM property.Stop curr...
分类:
数据库 时间:
2014-05-03 23:30:08
阅读次数:
505
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 one transaction (ie...
分类:
其他好文 时间:
2014-05-02 00:37:20
阅读次数:
349
题目题意:有n1个o, n2个r, n3个z, n4个~, 求有多少种组合使
组合出来的字符串的任意前缀都满足 o的个数>=r的个数,r的个数>=z的个数 ……………………思路:递推,枚举用四重循环控制orz~的个数符合题意,
然后当前个数的orz~等于之前orz~分别少一个推过来的,所以相加上,注...
分类:
其他好文 时间:
2014-05-02 00:24:58
阅读次数:
318
这道题我一开始想到用递归方法,可以把规模大的问题变成规模小的问题,但是觉得递归的时间复杂度很高,因为它会把相同的问题进行重复计算,然后我想是不是有什么down-up的方法,先把所有的子问题的结果保存起来,但是发现问题的最优解并不能由子问题的最优解推导出来。最后就想到买股票的时候,我们在一个局部极小的...
分类:
其他好文 时间:
2014-05-01 19:24:02
阅读次数:
250
这道题要求的一个min和一个max,只是这个min所在的位置要在max所在位置的左边。有一种做法是采用蛮力算法,也就是通过从左往右遍历,把每一个元素都当做min,然后再在这个元素的右边找一个最大值,这样得到一个profit,最后求得所有情况中profit的最大值即刻。但是这种做法的时间复杂度是O(n...
分类:
其他好文 时间:
2014-05-01 10:17:20
阅读次数:
287
??
Best Cow Line
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 8579
Accepted: 2629
Description
FJ is about to take his N (1 ≤ N ≤ 2,000) cows to the a...
分类:
其他好文 时间:
2014-04-29 13:48:21
阅读次数:
358
1、
??
String to Integer (atoi)
Implement atoi to convert a string to an integer.
Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yours...
分类:
其他好文 时间:
2014-04-29 13:22:22
阅读次数:
341