上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 38 下一页
摘要: 求某区间各个子集的和的根的最大的五个数。子集根其实就是这个数模9后的余数,注意的是要区分0和9,两者的余数都是0。、记录前i个数的和的根,设为sum数组,然后处理两个数组lft[i][j]表示从i开始往右,最先sum出现根为j的位置。rht[i][j]表示从i开始往左,最先sum开始出现根为j的位置... 阅读全文
posted @ 2015-02-02 22:22 chenjunjie1994 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 最近这些天,确实很烦恼。因为发现自己好像无论怎么样努力,也赶不上那些强校的学生。不得不承认,我们是传统弱校了。停了有一周了,什么也不想写,不停的反思,到底自己在哪里比不上人。D说,那是因为自始至终你只有一个人在做,而人家是三个人。是吗?确实有点,自始至终只有一个人在训练,但不过是因为我明白,别人是不... 阅读全文
posted @ 2014-12-21 09:54 chenjunjie1994 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 简单的单调队列优化,注意是哪些点加入队列即可。#include #include #include #include #include #define N 500050#define LL __int64using namespace std;LL sum[N],dp[N]; int q[N];in... 阅读全文
posted @ 2014-12-10 22:21 chenjunjie1994 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 斜率DP入门题。推荐看看这篇http://www.cnblogs.com/ka200812/archive/2012/08/03/2621345.html看过之后,自己思考,发现有些不妥之处就是,其实CI必须为正数才能保证SUM【i】的那个比较条件是成立的,才能使用单调队列维护,没有这个条件,是不成... 阅读全文
posted @ 2014-12-10 13:01 chenjunjie1994 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 好题一道啦。做这题时,抓住两个问题:一、给某点染色时,其连通的点是否已有一点以全部代价染色。二、该点染什么颜色。嗯。第二个问题很容易,但第一个问题不容易了。我一开始就考虑祖父子三层结点的关系,认为在父结点时,要么子结点已染色,要么父结点已染色%#……*&¥%#……很复杂。。。。这是条件定得过于严格了... 阅读全文
posted @ 2014-12-08 17:16 chenjunjie1994 阅读(248) 评论(0) 推荐(0) 编辑
摘要: 想了好久,没思路。看别人说是卢卡斯,就去看卢卡斯了,看完卢卡斯,再用它推导一下,很容易就知道,答案是2^n的二进制中一的个数。改天找个时间写个卢卡斯的总结。~~~今晚竟然要上形势政治课,靠。。。。#include #include #include #include using namespace ... 阅读全文
posted @ 2014-12-07 17:00 chenjunjie1994 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 细心点想,就明白了,题目是求和为N的各数的最小公倍数的种数。其实就是求N以内的各素数的不同的组合(包含他们的次方),当然,是不能超过N的。用Dp能解决。和背包差不多。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #def... 阅读全文
posted @ 2014-12-07 15:28 chenjunjie1994 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 求前i个数的和,当到j时,即是求sj-si,得i-j的和。只要求前面的si最小即可。此处可以用单调队列维护。#include #include #include #include #define N 200500using namespace std;int num[N];struct node{ ... 阅读全文
posted @ 2014-12-07 09:49 chenjunjie1994 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 先确定M的大致范围后即可求。#include #include #include #include #include #define LL __int64#define N 60000LL square[N];LL spre[N];void init(){ spre[0]=0; spre[0]=0;... 阅读全文
posted @ 2014-12-06 21:17 chenjunjie1994 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 分组背包而已。注意的是,每个时间T,要把一组的全加进去比较一次。#include #include #include #include #include #define N 205#define T 41000using namespace std;int dp[T];struct node{ in... 阅读全文
posted @ 2014-12-06 20:43 chenjunjie1994 阅读(103) 评论(0) 推荐(0) 编辑
摘要: 单调队列来做,简单题了。维护一个最大的,一个最小的即可。#include #include #include #include #include using namespace std;#define N 1001000int num[N];int bigque[N],bhead,btail;int... 阅读全文
posted @ 2014-12-06 17:04 chenjunjie1994 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 简单的tarjan#include #include #include #include #define N 10010#define M 20010#define C 2001000using namespace std;struct edge{ int v,c; int next;}City[M... 阅读全文
posted @ 2014-12-06 16:28 chenjunjie1994 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 其实不过是大整数分解。。。注意两点:注意L 不能==N但是,N却可以是素数。。。囧#include #include #include #include #define LL __int64#define MAX 1LL>=1; a=(a>=1; } LL x=quick(a,m,n); if(x... 阅读全文
posted @ 2014-12-04 21:59 chenjunjie1994 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 二分加贪心,水过了。贪心是因为,不能存在覆盖,当存在覆盖时,留小坐标的。#include #include #include #include #define N 300100using namespace std;struct Point{ int left,right;}pl[N];int qu... 阅读全文
posted @ 2014-12-04 20:05 chenjunjie1994 阅读(264) 评论(2) 推荐(0) 编辑
摘要: Tarjan缩点后求入度为0的点,即是要求最少电话。#include #include #include #include using namespace std;int cst[1010];struct Edge{ int u,v; int next;}edge[2010];int head[10... 阅读全文
posted @ 2014-12-01 16:51 chenjunjie1994 阅读(152) 评论(0) 推荐(0) 编辑
上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 38 下一页