BeauWill
BeauWill
全部文章
分类
归档
标签
去牛客网
登录
/
注册
BeauWill的博客
全部文章
(共46篇)
题解 | 买橘子
方法众多,以下给出五种。方法一:完全背包 #include <iostream> #include <vector> #include <algorithm> constexpr int inf = 1E9; int main() { std::ios::...
2026-02-27
0
56
题解 | 波斐契那数列
由于n比较大,因此考虑矩阵快速幂,具体推导过程见代码的注释昨天的每日一题也可用矩阵快速幂(不过有点大炮打蚊子了),贴一个昨天每日一题我的题解(矩阵快速幂在方法三):https://www.nowcoder.com/discuss/856068762758311936方法一:使用行向量 #includ...
2026-02-26
1
46
题解 | 斐波那契数列
方法一:循环枚举(也可理解为滚动数组(变量)优化DP),时间复杂度O(k),空间复杂度O(1) #include <iostream> constexpr int P = 1E9 + 7; int main() { std::ios::sync_with_stdio(false)...
2026-02-25
0
84
题解 | 世界树上找米库
多源bfs(Modern Cpp) #include <iostream> #include <vector> #include <queue> #include <algorithm> constexpr int inf = 1E9; void ...
2026-02-24
0
46
题解 | 小红统计区间(easy)
1.双指针写法 #include <iostream> #include <vector> using i64 = long long; int main() { std::ios::sync_with_stdio(false); std::cin.tie(nul...
2026-02-23
0
51
题解 | 小d和超级泡泡堂
Modern Cpp #include <iostream> #include <vector> #include <string> #include <array> #include <queue> int main() { std...
2026-02-18
0
44
题解 | 小红的数位删除
bfs搜索一下即可,每次枚举删除的数字是a或者b,然后枚举删除a或者b的每一个数位,通过转字符串删除该位,再转回int #include <iostream> #include <queue> #include <array> #include <map&g...
2026-02-17
0
52
题解 | 游游的最小公倍数
打表发现,其中一组答案应该接近n / 2且它两互质,因此对于每组答案,我们枚举a从n / 2到1,此时b = n - a,只要a和b互质,那么输出即可 #include <iostream> #include <vector> #include <numeric>...
2026-02-15
0
47
题解 | 中位数之和
Modern C++并使用jiangly鸽鸽的模板 #include <iostream> #include <vector> #include <cassert> #include <algorithm> using i64 = long long...
2026-02-13
0
52
题解 | 小红的数组清空
贴个multiset暴力模拟的代码 #include <iostream> #include <set> int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); std::cou...
2026-02-09
0
40
首页
上一页
1
2
3
4
5
下一页
末页