XiaoXiauwu
XiaoXiauwu
全部文章
分类
归档
标签
去牛客网
登录
/
注册
XiaoXiauwu的博客
全部文章
(共31篇)
题解 | 括号区间匹配
水题,区间dp即可,转移是显然(?)的。 #include<bits/stdc++.h> using i64 = long long; int main() { std::cin.tie(nullptr)->sync_with_stdio(false); std...
2025-04-22
0
11
题解 | 斐波那契数列
水题。直接按定义递推即可,n 若很大,可以使用矩阵快速幂。 #include<bits/stdc++.h> using i64 = long long; int main() { std::cin.tie(nullptr)->sync_with_stdio(false);...
2025-04-22
0
12
题解 | 23年OPPO-a的翻转
水题,直接模拟即可,复杂度 O(logn) #include<bits/stdc++.h> using i64 = long long; int main() { std::cin.tie(nullptr)->sync_with_stdio(false); i...
2025-04-22
0
14
题解 | [CQOI2007]涂色PAINT
水题,跑一遍 O(n^3) 的区间 dp 即可,转移是显然(?)的。 #include<bits/stdc++.h> using i64 = long long; int main() { std::cin.tie(nullptr)->sync_with_stdio(fa...
2025-04-22
0
10
题解 | 跳台阶
水题,经典dp,转移是显然的。 class Solution { public: int jumpFloor(int number) { int n = number; std::vector<int> dp(n + 1); dp...
2025-04-22
0
10
题解 | ranko的手表
史题,不知道谁把它当成简单题的,实现特别麻烦。直接暴力找出所有可能时间,然后直接统计即可。 #include<bits/stdc++.h> using i64 = long long; int main() { std::cin.tie(nullptr)->sync_wi...
2025-04-22
0
11
题解 | 合并回文子串
史题,考虑dp[l1][r1][l2][r2] 维护“考虑了 A 串中从 l1 到 r1 部分,B 串从 l2 到 r2 部分,是否能构成回文串”,然后dp时分类讨论一下转移情况,当更新出新的合法dp值时,直接更新答案即可,时间复杂度 O(n^4)。 #include<bits/stdc++....
2025-04-22
0
14
题解 | 【模板】循环队列
水题,但是我懒得用全局数组实现了,有stl为什么不用。 #include<bits/stdc++.h> using i64 = long long; int main() { std::cin.tie(nullptr)->sync_with_stdio(false); ...
2025-04-21
0
11
题解 | 【模板】队列
水题,开全局数组,双指针维护即可。 #include<bits/stdc++.h> using i64 = long long; int q[100010]; int l = 0, r = 0; int main() { std::cin.tie(nullptr)->...
2025-04-21
0
12
题解 | 小红取数
水题,考虑dp[i][j] 为:考虑到第 i 个数,模 k 余 j 的最大选数方案即可,转移是显然的,注意边界即可。 #include<bits/stdc++.h> using i64 = long long; int main() { std::cin.tie(nullptr...
2025-04-21
0
12
首页
上一页
1
2
3
4
下一页
末页