上一页 1 2 3 4 5 6 7 ··· 9 下一页
摘要: 题目链接 首先按照题意我们可以模拟出来一个小根堆,这样我们就把数组转化为了一棵树。 考虑任意一棵子树,它至多有两个儿子,至少有零个儿子。 先求出以$i$号点为根的子树的节点数,记为$s_i$ 这棵子树填入$s_i$个不相同的数的答案记为$f_i$ 我们从$1 \sim n$排列里选出了任意$s_i$ 阅读全文
posted @ 2020-07-28 07:57 zhuzihan 阅读(83) 评论(0) 推荐(0) 编辑
摘要: 引用博客: 带边数的无向连通图计数 Pretty is a smart girl who loves math very much. She has already learned FFT algorithm. She loves traveling and she is looking forwa 阅读全文
posted @ 2020-07-27 16:32 zhuzihan 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 题目链接 学习线段树的区间懒标记想法,我们把整个区间当作一个区间。 懒标记有$add,mul,cov$ \(add\):区间里每个数加上多少。 \(mul\):区间里每个数乘上多少。 \(cov\):最近一次区间赋值的值是多少。 利用上面三个标记,我们就解决了所有区间修改。 但是单点修改呢? 题目中 阅读全文
posted @ 2020-07-27 16:26 zhuzihan 阅读(88) 评论(0) 推荐(0) 编辑
摘要: 题目链接 求给定区间内有无两个数的和/差/积为给定的数(两个数可相同)。 首先操作可离线,范围又只有$10^5$,还是区间问题,又没有什么数据结构维护,那大概就是莫队吧。 我们维护每种数出现次数,记为$sum_i$ 然后开两个bitset当作bool 数组用,分别统计$i$和$100000 - i$ 阅读全文
posted @ 2020-07-27 16:13 zhuzihan 阅读(100) 评论(0) 推荐(0) 编辑
摘要: Ball In Geometry, a spherical cap is a portion of a sphere cut off by a plane. If the radius of the sphere is \(r\) and the height of the spherical ca 阅读全文
posted @ 2020-07-27 16:01 zhuzihan 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 题面: In digital image processing, thresholding is the simplest method of segmenting images. From a grayscale image, thresholding can be used to create 阅读全文
posted @ 2020-07-27 14:52 zhuzihan 阅读(104) 评论(0) 推荐(0) 编辑
摘要: \[ \sum_{i=1}^{n} \mu(i)\\ \sum_{i=1}^{n} \varphi(i)\\ \] 杜教筛模板: \[ S(n) = \sum_{i=1}^{n} f(i)\\ \sum_{i=1}^{n} \sum_{d|i} f(d) * g(\frac{i}{d})\\ =\s 阅读全文
posted @ 2020-07-24 20:08 zhuzihan 阅读(91) 评论(0) 推荐(0) 编辑
摘要: Gym - 101853G 扩展BSGS模板 #include <map> #include <cmath> #include <cstdio> #include <iostream> #include <unordered_map> #define ll long long using names 阅读全文
posted @ 2020-07-24 19:49 zhuzihan 阅读(87) 评论(0) 推荐(0) 编辑
摘要: Gym - 100883H 一共有$N$个人要乘船出行。 你有两条船,每次载人出去一次花费$c_1,c_2$,载人量为$n_1,n_2$ 船必须载满才能出行,求运送所有人的最小花费。 首先利用裴蜀定理和扩展欧几里得求出一组解。 \(n_1x + n_2y = gcd(n_1,n_2) = g\) 然 阅读全文
posted @ 2020-07-24 19:48 zhuzihan 阅读(89) 评论(0) 推荐(0) 编辑
摘要: POJ - 2480 求$\sum_\gcd(i,n)~(1\leq n\leq 109)$ 显然有 \[ \sum_{i=1}^{n}\gcd(i,n)=\sum_{d|n}d\varphi(\frac nd) \] (考虑 \(\varphi\) 的意义) 然后直接做随便做。 Code #inc 阅读全文
posted @ 2020-07-24 18:55 zhuzihan 阅读(70) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 9 下一页