上一页 1 ··· 3 4 5 6 7 8 9 10 11 下一页
摘要: OI生涯中印象最深一题 一直被卡0。。 1 #include 2 #define clr(a,x) memset(a,x,sizeof(a)) 3 #define rep(i,l,r) for(int i=l;is; 29 if(k==1) return -1; 30 ... 阅读全文
posted @ 2015-08-02 21:12 ChenThree 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 答案就是 ∑ d * phi(n / d) (d | n) 。。没得说。。 1 #include 2 #define clr(a,x) memset(a,x,sizeof(a)) 3 #define rep(i,l,r) for(int i=l;i1) ans=ans/x*(x-1);32 ... 阅读全文
posted @ 2015-07-29 13:47 ChenThree 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 数论题怎么都长得差不多。。。这里需要对欧拉函数做一下啊前缀和题解orzlsj:要求gcd(x, y) = p (1 2 #define clr(a,x) memset(a,x,sizeof(a)) 3 #define rep(i,l,r) for(int i=l;i>1)+1){41 ... 阅读全文
posted @ 2015-07-28 14:29 ChenThree 阅读(467) 评论(3) 推荐(0) 编辑
摘要: 其实是最大团问题,但是直接dfs不保证不tle题解再次来自lsj(懒得敲):对于一个强连通分量, 一定是整个走或者不走, 所以tarjan缩点然后跑dijkstra或spfaspfa 1 #include 2 #define clr(a,x) memset(a,x,sizeof(a)) 3 #def... 阅读全文
posted @ 2015-07-27 23:47 ChenThree 阅读(171) 评论(1) 推荐(0) 编辑
摘要: 题目http://pan.baidu.com/s/1gdfb4bht1水题 1 #include 2 #define ok(a,l,r) (((l)hehe;32 int main()33 { 34 int k=read(),p=read(),q=read(),l=read(),r=r... 阅读全文
posted @ 2015-07-26 16:16 ChenThree 阅读(227) 评论(1) 推荐(0) 编辑
摘要: 题解来自lsj大神:假设C君为(0, 0), 则右上方为(n - 1, n - 1).phi(x)即欧拉函数是少于或等于n的数中与互质的数的数目Euler函数表达通式:euler(x)=x(1-1/p1)(1-1/p2)(1-1/p3)(1-1/p4)…(1-1/pn),其中p1,p2……pn为x的... 阅读全文
posted @ 2015-07-26 12:18 ChenThree 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 按一开始没开ll。。。wa*2数论的题目总是需要绕一点弯子。。。题解来自lsj大神:一个点(x, y)的能量损失为 (gcd(x, y) - 1) * 2 + 1 = gcd(x, y) * 2 - 1.设g(i)为 gcd(x, y) = i ( 1 = 2 , i * k 2 #define ... 阅读全文
posted @ 2015-07-26 11:51 ChenThree 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 二分答案 给白色的边加上边权使刚刚好取到need条这个二分是靠有右的。。。。 1 #include 2 #define clr(a,x) memset(a,x,sizeof(a)) 3 #define rep(i,l,r) for(int i=l;i=need?ans:-1;50 }51 int e... 阅读全文
posted @ 2015-07-24 22:55 ChenThree 阅读(366) 评论(0) 推荐(0) 编辑
摘要: 二分答案 若存在负圈则说明答案可以更优 dfs版spfa判负圈 1 #include 2 #define clr(a,x) memset(a,x,sizeof(a)) 3 #define rep(i,l,r) for(int i=l;ie[maxn];29 void dfs(int a)30 {31... 阅读全文
posted @ 2015-07-24 20:21 ChenThree 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 原以为要链剖什么的 然后。。直接dfs用set维护前缀和 注意初始化insert(0)(为了保证根节点可取) 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #incl... 阅读全文
posted @ 2015-07-24 19:03 ChenThree 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 离散化+并查集set比unique慢好多unique 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #define clr(a,x) memset(a,x,sizeo... 阅读全文
posted @ 2015-07-24 15:31 ChenThree 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 不知道在干吗。。好像就写了cyc的比赛 阅读全文
posted @ 2015-07-24 13:04 ChenThree 阅读(134) 评论(1) 推荐(0) 编辑
摘要: 题解详见lsj大神blog 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #define clr(a,x) memset(a... 阅读全文
posted @ 2015-07-24 13:03 ChenThree 阅读(161) 评论(1) 推荐(0) 编辑
摘要: 记录每天最早开始和最晚结束的就ok了 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #define clr(a,x) memset(a,x,sizeof(a)) 9 #define rep... 阅读全文
posted @ 2015-07-22 23:25 ChenThree 阅读(195) 评论(0) 推荐(0) 编辑
摘要: lcs+dp 用树状数组维护 最大值 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #define lowbit(a) ((a)&(-(a)))10 #define ... 阅读全文
posted @ 2015-07-22 23:00 ChenThree 阅读(144) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 下一页