上一页 1 2 3 4 5 6 7 ··· 64 下一页
摘要: 欧拉函数(Euler's totient function),通常用希腊字母 \(\varphi(n)\) 表示,是数论中一个非常重要的函数。 核心定义 对于正整数 \(n\),欧拉函数 \(\varphi(n)\) 是指:在小于或等于 \(n\) 的正整数中,与 \(n\) 互质(最大公约数为 1 阅读全文
posted @ 2026-05-11 18:03 quanjun 阅读(38) 评论(0) 推荐(0)
摘要: 题目链接:https://www.luogu.com.cn/problem/P11175 解题思路完全来自 oi.wiki 示例程序: #include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 5; int fadd(i 阅读全文
posted @ 2026-05-10 10:16 quanjun 阅读(12) 评论(0) 推荐(0)
摘要: 题目链接:https://loj.ac/p/143 解题思路:完全来自 oi.wiki 时间复杂度:\(O(k \log^3 n)\)。 Miller–Rabin 素性测试 的结论 对于一个奇数 \(n\),将 \(n - 1\) 表示为 \[n - 1 = 2^s \cdot d \]其中,\(d 阅读全文
posted @ 2026-05-08 18:06 quanjun 阅读(11) 评论(0) 推荐(0)
摘要: 1. BSGS 例题:P3846 【模板】BSGS / [TJOI2007] 可爱的质数 BSGS 的 oi wiki 介绍:链接 但是我感觉还是 chebs大佬的博客 更好理解。 示例程序: #include <bits/stdc++.h> using namespace std; using l 阅读全文
posted @ 2026-05-05 14:49 quanjun 阅读(11) 评论(0) 推荐(0)
摘要: 双倍经验 题目链接:https://www.luogu.com.cn/problem/P1495 解题思路:完全来自 oi wiki 注意:要开 __int128,不然会被 hack。 示例程序: #include <bits/stdc++.h> using namespace std; using 阅读全文
posted @ 2026-05-04 15:45 quanjun 阅读(16) 评论(0) 推荐(0)
摘要: 题目链接:https://www.luogu.com.cn/problem/P5169 暴力解法就是:线性基,然后对于每次询问的 \(x\),枚举 \((u,v)\) 对,跑一遍线性基就是否存在连接 \(u - v\) 的异或和为 \(x\) 的路径。时间复杂度 \(O(q \cdot n^2 \c 阅读全文
posted @ 2026-04-30 19:43 quanjun 阅读(14) 评论(0) 推荐(0)
摘要: 题目链接:https://www.luogu.com.cn/problem/U682392 就是维护一个桶,对桶数组求 FWT 即可。 \(0\) 要特判。 示例程序: #include <bits/stdc++.h> using namespace std; const int maxn = (1 阅读全文
posted @ 2026-04-30 18:32 quanjun 阅读(9) 评论(0) 推荐(0)
摘要: 题目链接:https://www.luogu.com.cn/problem/P4717 解题思路完全来自 oi.wiki 补充理解: 在 或(or)运算 中, \[FWT[A]_i \cdot FWT[B]_i \]\[= \left( \sum_{i \cup j=i} A_j \right) \ 阅读全文
posted @ 2026-04-30 15:30 quanjun 阅读(9) 评论(0) 推荐(0)
摘要: 题目链接:https://acm.hdu.edu.cn/showproblem.php?pid=3605 说明 hdu 的 G++ 编译器 比 C++ 编译器 慢,而这题比较卡时间,需要用 C++ 编译器。 但是 C++ 编译器不支持 万能头,所以你得手写 非万能头 的头文件,然后用 C++ 提交。 阅读全文
posted @ 2026-04-29 14:47 quanjun 阅读(11) 评论(0) 推荐(0)
摘要: 题目链接:https://www.luogu.com.cn/problem/P1559 模拟退火模板题。 实例程序: #include <bits/stdc++.h> using namespace std; int n, P[22][22], Q[22][22], p[22]; long long 阅读全文
posted @ 2026-04-29 13:35 quanjun 阅读(11) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 ··· 64 下一页