冷艳的西红柿刷牛客
冷艳的西红柿刷牛客
全部文章
分类
归档
标签
去牛客网
登录
/
注册
冷艳的西红柿刷牛客的博客
全部文章
(共111篇)
题解 | 来硬的
#include <iostream> #include <vector> using namespace std; //类似于背包问题,代码逻辑的话和0 - 1背包不同的主要是1.总体积(本题是铁矿石大小)可以超出容量 2.可以选择一个物品升级 //针对超出容量我们只需...
2025-11-22
0
8
题解 | 【模板】分组背包
#include <iostream> #include <vector> #include <cstring> using namespace std; const int G = 105, N = 3005, M = 3005; int main() {...
2025-11-20
0
14
题解 | 【模板】二维费用背包
#include <iostream> #include <vector> #include <cstring> using namespace std; //相比一维多了一次循环一个状态,状态压缩还是和一维差不多,核心是确保本轮不会访问到已经更新的值,这个显...
2025-11-20
0
11
题解 | 【模板】多重背包
#include <iostream> #include <vector> using namespace std; const int N = 3005; //逻辑和完全背包基本一样,注意对于w = 0的特殊处理,然后就是使用二维状态会oom,需要使用dp[j]滚动数...
2025-11-19
0
17
题解 | 【模板】完全背包
#include <iostream> #include <vector> using namespace std; const int N = 1005; //一开始按照常规思路在for (j...)循环枚举一个for (k = 0; k < m / w[i]....
2025-11-18
0
12
题解 | 四值零和
#include <iostream> #include <vector> #include <algorithm> using namespace std; typedef long long ll; const int N = 2510; //查找a中有...
2025-11-15
0
15
题解 | 【入门班】借教室
#include <iostream> #include <vector> using namespace std; const int N = (int) 1e6 + 5; bool judge(long long diff[], int n,const vector...
2025-11-15
0
12
题解 | 整点巧克力
#include <iostream> using namespace std; int main() { int n, m; cin >> n >> m; int* a = new int[n + 1]; for (int i = 0; i < ...
2025-11-14
0
15
题解 | 山峰数组计数
#include <iostream> using namespace std; typedef long long ll; int main() { int n; cin >> n; int tmp; ll* sum = new ll[n + 1]; sum...
2025-11-14
0
13
题解 | 小红的矩阵
#include <iostream> #include <vector> using namespace std; //注意精度 int main() { long long n, m, k; cin >> n >> m >> ...
2025-11-14
0
17
首页
上一页
1
2
3
4
5
6
7
8
9
10
下一页
末页