A-ACfunTime Limit:2000/1000MS (Java/Others)Memory Limit:128000/64000KB (Java/Others)SubmitStatusProblem Description题目链接点击打开链接As a former ACMer, "AC" i...
分类:
其他好文 时间:
2015-03-27 21:56:23
阅读次数:
245
题意:有很多棍子,从棍子中选出两个棍子集合,使他们的和相等,求能取得的最多棍子数。解法:容易看出有一个多阶段决策的过程,对于每个棍子,我们有 可以不选,或是选在第一个集合,或是选在第二个集合 这三种决策。因为两个集合最后的和要相等,那么令一个集合为正,另一个为负,那么最后和为0,我们用偏移0的量来作...
分类:
其他好文 时间:
2015-03-05 23:33:09
阅读次数:
250
原文:https://github.com/KIDx/ACdream#%E5%AE%89%E8%A3%85%E4%BE%9D%E8%B5%96%E6%A8%A1%E5%9D%97安装依赖$ sudo apt-get update$ sudo apt-get install imagemagick$ ...
分类:
系统相关 时间:
2015-03-03 23:35:04
阅读次数:
318
传送门:Number theory题意:给n个数,n 和 每个数的范围都是 1---222222,求n个数中互质的对数。分析:处理出每个数倍数的个数cnt[i],然后进行莫比乌斯反演,只不过这里的F(i)=cnt[i]*(cnt[i]-1)/2.#pragma comment(linker,"/ST...
分类:
其他好文 时间:
2015-02-20 23:09:51
阅读次数:
241
传送门:GCD SUM题意:给出N,M执行如下程序:long long ans = 0,ansx = 0,ansy = 0;for(int i = 1; i #include #include #include #include #include #include #include #include...
分类:
其他好文 时间:
2015-02-20 21:59:10
阅读次数:
250
分析:实际上,我们用next[i]表示 T[i-n] 和T[1-n]的最长公共前缀,那么a[i]=next[i] +next[i+1]...... +next[n]; 最长公共前缀(lcp)有3种方法 : 扩展kmp ,hash 和后缀数组 。
方法一 :扩展kmp
//#pragma comment(linker, "/STACK:102400000,102400000")
...
分类:
其他好文 时间:
2015-01-30 22:45:56
阅读次数:
318
题意就是 给出一段插入,求出最后的序列。
做到n*logn基本都能过。
我用线段树做的。不过开始没想到怎么解决插入顺序问题,只知道存一个数组表示当前可以插入几个数。
后来ACdream群给了解答。每次update的时候,如果left的插入数大于插入就继续,否者就走right,并且将插入改为插入-left的插入数。
//PS 其实,觉得SBT应该能做的。
#include
...
分类:
其他好文 时间:
2015-01-26 13:45:03
阅读次数:
177
http://acdream.info/problem?pid=1116
Problem Description
give you a string, please output the result of the following function mod 1000000007
n is the length of the string
f() is the funct...
分类:
其他好文 时间:
2014-12-26 21:44:24
阅读次数:
218
http://acdream.info/problem?pid=1019
Problem Description
Now we have a long long string, and we will have two kinds of operation on it.
C i y : change the ith letter to y.
Q i j : check whet...
分类:
编程语言 时间:
2014-12-26 16:41:35
阅读次数:
338
题目大意:求有多少个数对(x,y),使得x
具体去见ACdream的博客 里面讲的还是很详细的 地址 http://blog.csdn.net/acdreamers/article/details/8542292
其实求的时候只需要枚举每个素数暴力就行了
由于有1/1+1/2+1/3+...+1/n=O(logn)这个结论 因此每个质数枚举时是均摊O(logn)的
而质数恰好有O(n/lo...
分类:
其他好文 时间:
2014-12-16 11:43:35
阅读次数:
189