上一页 1 2 3 4 5 6 ··· 15 下一页
摘要: 通道题意:给n(n #include #include #include using namespace std;int v7[8][8][8][8][8][8][8];int v6[8][8][8][8][8][8];int v5[8][8][8][8][8];int v4[8][8][8][8]... 阅读全文
posted @ 2015-09-21 21:33 mithrilhan 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 通道题意:给出只有AB组成的字符串S,求第k个不在S中出现的串T。思路:我们可以把原串中logK左右的串都拿出来排序。然后直接二分答案求解即可代码:#include #include #include #include #include using namespace std;typedef lon... 阅读全文
posted @ 2015-09-20 11:00 mithrilhan 阅读(247) 评论(0) 推荐(0) 编辑
摘要: 通道题意:计算(5+26√)1+2^x.思路:循环节是(p+1)*(p-1),然后就是裸的矩阵快速幂啦。代码:#include#include#include#include#includeusing namespace std;typedef long long ll;const int N = ... 阅读全文
posted @ 2015-09-19 18:36 mithrilhan 阅读(228) 评论(0) 推荐(0) 编辑
摘要: 通道题意:首尾加字符,询问多少个本质不同的回文串和多少个不同回文串思路:标记即可,分别维护左右last指针代码:#include #include typedef long long ll;template inline bool rd(T &ret) { char c; int sgn; ... 阅读全文
posted @ 2015-09-01 14:19 mithrilhan 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 通道题意:有N个位置,M个操作。操作有两种,每次操作如果是1 a b c的形式表示在第a个位置到第b个位置,每个位置加入一个数c,如果是2 a b c形式,表示询问从第a个位置到第b个位置,第C大的数是多少思路:先开一颗权值线段树。对于当前结点K,它表示了权值范围为a~b的所有结点的信息。但是有人要... 阅读全文
posted @ 2015-09-01 10:17 mithrilhan 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 通道题意:一个公司获得了一个厂房n(10^5)天的使用权和一笔启动资金C(10^9),准备在n天里租借机器生产来获得收益可以租借的机器有M(10^5)个,每个机器有四个值,D,P,R,G (D= P[j]可以看出是O(n^2)的,显然不行啊令h[j] = f[j] + R[j]- P[j] - G[... 阅读全文
posted @ 2015-08-31 18:32 mithrilhan 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 通道题意:区间K大代码:#include#includeusing namespace std;int n,m,sz,tot;int root[100001],a[100001],ls[8000001],rs[8000001],s[8000001];int num[100001],hash[1000... 阅读全文
posted @ 2015-08-30 21:39 mithrilhan 阅读(343) 评论(0) 推荐(0) 编辑
摘要: 通道题意:选2条不相交的路径,使得包含的点最多,一条路径的定义是h[u] >= h[v] && d[u]v可走思路:太高深的doubility!转自:i和j之间,大于等于a[i]并且小于等于a[j]的数如果超过一定的值的时候,i就不向j连边,因为选2条路径,如果两个点之间夹在他们之间的点很多的话,费... 阅读全文
posted @ 2015-08-20 21:13 mithrilhan 阅读(256) 评论(0) 推荐(0) 编辑
摘要: 通道题意:区间k大,单点修改思路:裸,复杂度n(lgn)^2代码:#include #include #include #include #include using namespace std;const int N = 60010 * 5;const int M = 100100 * 4;#de... 阅读全文
posted @ 2015-08-20 18:13 mithrilhan 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 通道题意:有3*n个人,分成n组,每组三个人。给出k个三元组,这三个人不可组队,问最后可以组队的总方案数思路:当k=0时,有(C[3*n][3]*C[3*n-3][3]*……*C[3][3])/n!种方案,展开以后可以得到dp[n]=(3*n)!/n!/6^n。显然可以写成递推式:dp[n]=dp[... 阅读全文
posted @ 2015-08-19 22:49 mithrilhan 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 通道题意:给两个数a和b,然后在[a,b]内的每一个数y都可以表示成x^k=y,要求x尽量最小,k尽量最大,然后求所有的k之和思路:很容易知道[1,n]中有多少个数可以表示成k次方的形式,即n^(1/k)个,但是,一个数的平方包含了4 6 8 10……次方.如果知道至多只能表示成k次方的数有多少个,... 阅读全文
posted @ 2015-08-19 20:14 mithrilhan 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 通道题意:给你一个正整数N,确定在1到N之间有多少个可以表示成M^K(K>1)的数。思路:我们可以由n^(1/p),知道指数为p的有多少个数。通过观察,可以发现若一个数可以表示成x^(k*t),则可以表示成(x^k)^t。因此指数必然为素数。枚举素数便可以得到指数为p的个数,但是可能出现重复,例如:... 阅读全文
posted @ 2015-08-19 19:54 mithrilhan 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 通道题意:给出n个数,n-1个操作方法,求(n-1)!的操作顺序得到的和是多少思路:代码:#include #include #include using namespace std;typedef long long ll;template inline bool rd(T &ret) { ... 阅读全文
posted @ 2015-08-18 19:12 mithrilhan 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 通道题意:对于给出的n个询问,每次求有多少个数对(x,y),满足a≤x≤b,c≤y≤d,且gcd(x,y) = k,gcd(x,y)函数为x和y的最大公约数思路:ans = cal(b, d) - cal(a - 1, d) - cal(b, c - 1) + cal(a - 1, c- 1),加上... 阅读全文
posted @ 2015-08-17 21:42 mithrilhan 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 通道题意:给定整数N,求1#include #include using namespace std;typedef long long ll;template inline bool rd(T &ret) { char c; int sgn; if(c = getchar() , c ... 阅读全文
posted @ 2015-08-17 21:41 mithrilhan 阅读(148) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 15 下一页