摘要: In Newton-Cotes formula, we choose \(n+1\) evenly spaced points on the interval to do Lagrange interpolation and deduce a formula from the integral of 阅读全文
posted @ 2025-08-15 12:44 studentDL 阅读(64) 评论(0) 推荐(0)
摘要: As differentiation is inherently less stable than integration and benefits little from high-order methods, we usually choose easy methods. Mostly, we 阅读全文
posted @ 2025-08-14 12:36 studentDL 阅读(11) 评论(0) 推荐(0)
摘要: As \(n\) gets large, Newton-Cotes formulas face Runge's phenomenon, which leads to the drop of precision. Thus in practice, we normally adopt Simpson' 阅读全文
posted @ 2025-08-14 11:17 studentDL 阅读(7) 评论(0) 推荐(0)
摘要: Newton-Cotes formula is a general class of formulas that estimate the integral of a function with the integral of a Lagrange interpolation polynomial 阅读全文
posted @ 2025-08-14 10:48 studentDL 阅读(32) 评论(0) 推荐(0)
摘要: T1 显然我们选择的点度数为2。 考虑若答案为Yes,则原图最多有5个度数为2的点。多于5个直接判为No。 因此可以枚举所有度数为2的点,暴力判断以该点为根,两个儿子的子树是否为菊花图。这是简单的,因为树为菊花图当且仅当点数不超过2或者一度点的个数等于点数-1。 时间复杂度 \(O(n)\)。 T2 阅读全文
posted @ 2024-08-07 22:53 studentDL 阅读(20) 评论(0) 推荐(0)
摘要: https://www.luogu.com.cn/training/168096 CF1359E Lemma: \(\forall x\in \mathbb{N},\ x \bmod a \bmod b=x \bmod b \bmod a \iff a\mid b\ (a<b)\) Proof: 因 阅读全文
posted @ 2024-07-09 11:51 studentDL 阅读(27) 评论(0) 推荐(0)
该文被密码保护。 阅读全文
posted @ 2024-06-18 13:25 studentDL 阅读(0) 评论(0) 推荐(0)
摘要: E 将所有的下标作为点,建一张无向图。 当且仅当可以询问 \([l,r]\) 时,在点 \(l\) 和 \(r+1\) 之间连一条边。 可以发现能求出 \([L,R]\) 的和等价于 \(L\) 与 \(R+1\) 连通,且最少询问次数等于两点间最短路径边数。 若以 \(L\) 为源点搜索,则显然从 阅读全文
posted @ 2024-05-28 20:54 studentDL 阅读(25) 评论(0) 推荐(0)
摘要: 我们现在有一棵有根树(节点的深度定义为根到它的距离)。 设节点 \(u\) 的所有儿子中,深度最大的点为它的长儿子,记作 \(son_u\)。(存在多个则任取一个,没有儿子则为空) 记每个节点到它的长儿子的变为长边,其余边为短边。 一段极长的全部由长边组成的链称为长链。特别的,按此过程划分后,不在长 阅读全文
posted @ 2024-05-04 22:47 studentDL 阅读(41) 评论(0) 推荐(0)
摘要: P3565 HOT 按这三个点中是否存在祖先关系讨论,发现其中必然存在两个点到它们的 lca 距离相等,且这个距离等于第三个点到该 lca 的距离。 而为方便计数,在三个点的 lca 处计算贡献。 下面是很神仙的 dp 状态。 设 \(f_{u,i}\) 表示 \(u\) 子树内到 \(u\) 距离 阅读全文
posted @ 2024-05-01 21:20 studentDL 阅读(22) 评论(0) 推荐(0)