chenlan114
chenlan114
全部文章
分类
题解(1)
归档
标签
去牛客网
登录
/
注册
chenlan114的博客
全部文章
(共67篇)
题解 | 【模板】完全背包
#include <bits/stdc++.h> using namespace std; using ll =long long; // 将long long别名化为ll,避免整数累加时的溢出问题 const ll N=1e3+5; // 定义背包容量的最大范围:题目中m≤1e...
2026-01-07
0
44
题解 | 完全背包前置题
#include <iostream> using namespace std; using ll = long long; const ll N = 1e3 + 5; ll v[N]; bool dp[N]; // dp[j]表示“能否凑出总价值j”,true为可以,false为不可...
2026-01-07
0
38
题解 | 明日DISCO
#include <iostream> using namespace std; using ll = long long; const ll N=505; ll a[N][N]; // 存储n×n棋盘的数值,数组开至505以适配题目中n≤500的范围 int main() { ...
2026-01-07
0
38
题解 | 小美打怪
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll N = 1e3 + 5; struct M { ll h = 0; // 怪物血量 ll a = 0; // 怪物攻击...
2026-01-05
0
43
题解 | 相助(easy)
#include <iostream> using namespace std; using ll=long long; const ll N=5e5+5; int a[N]; int main() { ll n; cin>>n; for(ll i=...
2026-01-03
0
36
题解 | 华华给月月准备礼物
#include <bits/stdc++.h> using namespace std; using ll=long long; const ll M=2e5+5; ll a[M]; // 存储原始数据(例如:各段绳子的长度) ll N,K; // N:原始数据的个数,K:需要满...
2026-01-02
0
47
题解 | 【模板】01背包(计数)
#include <bits/stdc++.h> using namespace std; struct it { int v = 0; int w = 0; }; const int N = 1e4 + 5; const int M = 1e9 + 7; it a[N...
2026-01-01
0
38
题解 | 先序遍历、中序遍历和后序遍历
#include <bits/stdc++.h> using namespace std; // 定义二叉树节点结构,存储每个节点的左孩子和右孩子(0表示无对应孩子节点) struct k{ int left=0; int right=0; }; // 邻接表存储整棵...
2026-01-01
0
48
题解 | 小红的01串
#include <iostream> using namespace std; using ll = long long; int main() { ll q; cin >> q; // 步骤1:处理多组测试用例(q组查询) while (...
2025-12-31
0
53
题解 | 人人都是好朋友
#include<iostream> #include<map> #include <unordered_map> using namespace std; using ll = long long; /* 大数据量场景(如 n=1e5、1e6,节点数极多):...
2025-12-30
0
44
首页
上一页
1
2
3
4
5
6
7
下一页
末页