上一页 1 2 3 4 5 6 ··· 19 下一页
摘要: 题意 对于区间,我们求出$[1,b]\(的答案减去\)[1,a-1]$的即可。 求$[1,n]$的答案: \(ans=\sum\limits_{i=1}^{n}\sum\limits_{j=1}^n[\frac{i*j}{\gcd(i,j)}\leqslant n]\) \(=\sum\limits 阅读全文
posted @ 2020-06-08 19:55 nofind 阅读(141) 评论(0) 推荐(0)
摘要: 题意 考虑转化下$f(S)$: 我们考虑$S$的$fail$树上的每一个点$x$,如果$x$到$0$的路径上有$cnt$个点(除去$x$和$0$),那么就会对$f(S)$产生$cnt$的贡献,于是现在$f(S)$变为了每个点会对很多点产生$1$的贡献,最后求和。 我们知道每个点代表一个前缀,那么我们 阅读全文
posted @ 2020-06-08 19:48 nofind 阅读(163) 评论(0) 推荐(1)
摘要: 题意 我们知道一个结论:\(\gcd(f_x,f_y)=f_{\gcd(x,y)}\)。 证明见这里。 于是我们考虑将$lcm$向$\gcd$方向化,我们知道$lcm$是给指数取$\max$,$\gcd$是给指数取$\min$,因此考虑$\min-\max$容斥: \(lcm(S)=\prod\li 阅读全文
posted @ 2020-06-05 19:43 nofind 阅读(206) 评论(1) 推荐(0)
摘要: 题意 先枚举一个点必须选,设该点为$x$。 将两棵树都以$x$为根,对于点$y$,如果选$y$必须要选$fa_y$,于是就变成了了最大权闭合子图。 code: #include<bits/stdc++.h> using namespace std; const int maxn=55; const 阅读全文
posted @ 2020-06-05 19:40 nofind 阅读(131) 评论(0) 推荐(0)
该文被密码保护。 阅读全文
posted @ 2020-06-05 16:33 nofind 阅读(0) 评论(0) 推荐(0)
摘要: 题意 考虑点分治来枚举树上联通块,对于一个联通块,我们做有依赖性的树形DP即可,需要用单调队列优化多重背包。 有依赖性的树形DP code: #include<bits/stdc++.h> using namespace std; const int maxn=510; const int maxm 阅读全文
posted @ 2020-06-05 14:28 nofind 阅读(125) 评论(0) 推荐(0)
摘要: 题意 我们先换种方式说一下$kF_{x,y}$: 对于叶子点对$(x,y)$,设其$lca$为$z$。 我们对$z$也进行赋值,$na<nb$为$0$,反之则为$1$。 那么$kF_{x,y}$其实就是如果$x/y$和$z$的值相同,那么就会产生$F_{x,y}$的代价。 于是我们现在变成了点的代价 阅读全文
posted @ 2020-06-04 21:01 nofind 阅读(144) 评论(0) 推荐(0)
摘要: 题意 算是第一道辛普森积分的题吧,这里有篇洛谷题解相当详细,这里就不赘述了。 code: #include<bits/stdc++.h> using namespace std; const int maxn=1010; const double eps=1e-7; int n; double al 阅读全文
posted @ 2020-06-04 15:04 nofind 阅读(150) 评论(0) 推荐(0)
摘要: 题意 二分半径,递归判断当前矩形是否能被覆盖。 code: #include<bits/stdc++.h> using namespace std; const int maxn=55; const double eps=1e-6; int T,K; double n,m; struct node{ 阅读全文
posted @ 2020-06-04 11:07 nofind 阅读(142) 评论(0) 推荐(0)
摘要: 题意 将$[l,r]$离线差分一下就变成了哈希冲突那道题了。 code: #include<bits/stdc++.h> using namespace std; const int maxn=1e5+10; const int maxa=10010; const int maxt=150; int 阅读全文
posted @ 2020-06-04 10:23 nofind 阅读(88) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 ··· 19 下一页