程家斌
程家斌
全部文章
分类
归档
标签
去牛客网
登录
/
注册
程家斌的博客
全部文章
(共53篇)
题解 | 连续子数组最大和(ACM版本)
#include <iostream> #include <vector> #include <climits> // 提供INT_MIN,表示负无穷大 using namespace std; const int N = 2e5 + 10; // 数组最大...
2025-07-29
0
38
题解 | 礼物的最大价值
class Solution { public: int maxValue(vector<vector<int> >& grid) { int n = grid.size(), m = grid[0].size(); ...
2025-07-27
0
37
题解 | 小易的升级之路
#include <iostream> using namespace std; int gcd(int a, int b) { if(b == 0) return a; return gcd(b, a % b); } int main() { int n,...
2025-07-27
0
38
题解 | 小易的升级之路
#include <iostream> using namespace std; int gcd(int a, int b) { if(b == 0) return a; return gcd(b, a % b); } int main() { int n,...
2025-07-27
0
41
题解 | 01背包
class Solution { // 定义dp数组:dp[j]表示背包承重为j时能获得的最大价值 // 初始化全为0(未放任何物品时,价值为0) int dp[1010] = {0}; public: // 函数参数:V(背包最大承重)、n(物品数量)、vw(物...
2025-07-27
0
34
题解 | 压缩字符串(一)
class Solution { public: string compressString(string param) { string ret; int left = 0, right = 0; while(right <...
2025-07-27
0
26
题解 | 小乐乐改数字
#include <iostream> using namespace std; int main() { int x; cin >> x; string str = to_string(x); string ret; for(...
2025-07-27
0
27
题解 | DNA序列
#include <iostream> using namespace std; int main() { string str; int n; cin >> str >> n; int left = 0, right = 0...
2025-07-27
0
31
题解 | 字符串替换
#include <cstdio> class StringFormat { public: string formatString(string A, int n, vector<char> arg, int m) { string re...
2025-07-27
0
30
题解 | 【模板】拓扑排序
#include <iostream> #include <vector> #include <queue> using namespace std; // 常量定义:顶点数量上限(根据题目约束设置为2e5+10,避免数组越界) const int N = 2e...
2025-07-27
0
39
首页
上一页
1
2
3
4
5
6
下一页
末页