赫he
赫he
全部文章
分类
题解(3)
归档
标签
去牛客网
登录
/
注册
赫he的博客
全部文章
(共53篇)
题解 | #阶乘末尾非零数字#
#include <iostream> using namespace std; int n; int main() { cin >> n; /* n! 中 偶数 和 5相乘会出现0,而其它情况 答案就是 相乘的最后一位 n2 表示 n!中有多...
2024-04-16
0
54
题解 | #求x到y的最少计算次数# bfs
#include <iostream> #include <stack> #include <vector> using namespace std; int x, y; stack<int> st; int s[201]; int main() ...
2024-04-15
0
39
题解 | #非递减序列# 逻辑c++
#include <iostream> #include <vector> using namespace std; vector<int> a; bool isT(){ for(int i = 0; i < a.size()-1; i++){ ...
2024-04-15
0
45
题解 | #求连续子数组的最大和# 前缀和
#include <iostream> #include <vector> using namespace std; vector<int> a; int main() { int x = 0; char c; int p = 1; ...
2024-04-13
0
38
题解 | #括号匹配深度# --栈
#include <iostream> #include <algorithm> #include <stack> using namespace std; string str; stack<int> st; int manL = 0; // 栈...
2024-04-12
0
26
题解 | #冒泡排序#
#include <algorithm> #include <cstdio> #include <iostream> #include <vector> using namespace std; const int N = 51; //dp[i][k]...
2024-04-08
0
43
题解 | #缺失的括号#
#include <iostream> #include <vector> using namespace std; string str; int main() { cin >> str; while(str.size()){ b...
2024-04-06
0
54
详细注释 | #数位染色#
#include <iostream> #include <string> using namespace std; const int N = 200; int dp[N]; int main() { long long n; cin >> n;...
2023-11-16
0
146
题解 | #红和蓝#
#include <iostream> #include <cstring> using namespace std; const int N = 1e5 + 10; int n; int e[N * 2], ne[N * 2], h[N], idx; // sons[i] ...
2023-11-15
0
187
dfs题解- | #二叉树中的最大路径和#
思路 对于二叉树种任一节点k,如果k作为某个路径上的一个点,这个路径的方向分两个方向: 1) 从节点k到k的父节点的方向。因为k的父节点dfs(par(k)))需要用到dfs(k),需要返回这个方向上的值,需要从k的左右子树中选择大的(要和0比较,贪心)那个子树再加上val(k) 2) 不到k的父节...
2023-11-04
2
161
首页
上一页
1
2
3
4
5
6
下一页
末页