会员
周边
新闻
博问
闪存
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
劝君
渭城朝雨浥轻尘,客舍青青柳色新。劝君更尽一杯酒,西出阳关无故人。
博客园
首页
新随笔
联系
订阅
管理
2026年5月28日
信息学竞赛中的梗[不断更新中]
摘要: 1. 我常常追忆过去。 出现在 P11831 [省选联考 2025] 追忆 的题目背景中。
阅读全文
posted @ 2026-05-28 20:37 quanjun
阅读(3)
评论(0)
推荐(0)
2026年5月27日
洛谷P2865 [USACO06NOV] Roadblocks G 题解 次短路
摘要: 题目链接:https://www.luogu.com.cn/problem/P2865 题目大意:求严格次短路。 解题思路: 先 spfa 跑一遍反图(由于是无向图,所以反图和原图其实是一样的图),得到估计函数的确定精确值。 然后 A* 跑一遍,即可。 示例程序: #include <bits/st
阅读全文
posted @ 2026-05-27 14:23 quanjun
阅读(6)
评论(0)
推荐(0)
2026年5月25日
CF896C Willem, Chtholly and Seniorious 题解 珂朵莉树 模板题
摘要: 题目链接:https://codeforces.com/problemset/problem/896/C 解题思路:完全来自 oi.wiki 示例程序: #include <bits/stdc++.h> using namespace std; using ll = long long; const
阅读全文
posted @ 2026-05-25 14:06 quanjun
阅读(11)
评论(0)
推荐(0)
P4777 【模板】扩展中国剩余定理(EXCRT)
摘要: 题目链接:https://www.luogu.com.cn/problem/P4777 解题思路:完全来自 oi.wiki 注意:中间过程有一步可能会超 long long,得开 int128(代码第 \(39\) 行,因为这里有三个数相乘了) 示例程序: #include <bits/stdc++
阅读全文
posted @ 2026-05-25 11:00 quanjun
阅读(3)
评论(0)
推荐(0)
2026年5月21日
洛谷P3193 [HNOI2008] GT考试 题解 KMP+矩阵乘法加速DP
摘要: 题目链接:https://www.luogu.com.cn/problem/P3193 解题思路: 建立完 KMP 的 nxt 数组之后(其实也可以建状态机,但是 \(m \le 20\) 所以建 状态机 并不是必要的),构造一个转移矩阵。然后矩阵乘法优化,就能够得到答案了。 #include <b
阅读全文
posted @ 2026-05-21 20:53 quanjun
阅读(6)
评论(0)
推荐(0)
洛谷P4345 [SHOI2015] 超能粒子炮·改 题解 Lucas定理
摘要: 题目链接:https://www.luogu.com.cn/problem/P4345 解题思路: 示例程序: #include <bits/stdc++.h> using namespace std; using ll = long long; const ll p = 2333; ll c[p+
阅读全文
posted @ 2026-05-21 16:53 quanjun
阅读(3)
评论(0)
推荐(0)
2026年5月20日
洛谷P4720 【模板】扩展卢卡斯定理 / exLucas
摘要: 参考链接:https://oi.wiki/math/number-theory/lucas/#exlucas-算法 解题思路: 扩展卢卡斯定理(Extended Lucas Theorem, exLucas),用于在模数 \(p\) 不一定是质数 的情况下,求组合数 \(C_n^m \pmod p\
阅读全文
posted @ 2026-05-20 18:57 quanjun
阅读(9)
评论(0)
推荐(0)
使用递归分块法求解 洛谷U687409 阶乘消去p再模p的a次方
摘要: 题目链接:https://www.luogu.com.cn/problem/U687409 解题思路: 求解 \((n!)_p \bmod p^a\) 的高效核心算法是递归分块法(常用于扩展卢卡斯定理 ExLucas)。 当 \(p^a\) 较小时(如 \(p^a \le 10^7\)),该算法可以
阅读全文
posted @ 2026-05-20 17:32 quanjun
阅读(8)
评论(0)
推荐(0)
ABC280D - Factorial and Multiple 题解 二分 + 勒让德公式
摘要: 题目链接:https://atcoder.jp/contests/abc280/tasks/abc280_d 解题思路: 首先对 \(K\) 进行质因数分解,然后二分 \(N\),判断 \(K\) 的每个质因数的次数是否都 \(\le n!\) 中包含的这个质因子的次数即可。 示例程序: #incl
阅读全文
posted @ 2026-05-20 14:40 quanjun
阅读(3)
评论(0)
推荐(0)
勒让德公式(Legendre 公式)
摘要: 参考链接:https://oi.wiki/math/number-theory/factorial/#legendre-公式 在正整数 \(n!\) 的质因数分解中,质数 \(p\) 的指数(即 \(n!\) 能被 \(p\) 整除的最高次数,记为 \(v_p(n!)\))可以通过以下公式计算: \
阅读全文
posted @ 2026-05-20 09:59 quanjun
阅读(6)
评论(0)
推荐(0)
下一页
公告