你能秒我
你能秒我
全部文章
分类
题解(4)
归档
标签
去牛客网
登录
/
注册
你能秒我的博客
全部文章
(共22篇)
题解 | 链表中的节点每k个一组翻转
import java.util.*; /* * public class ListNode { * int val; * ListNode next = null; * public ListNode(int val) { * this.val = val; * ...
2025-04-26
0
82
题解 | #又一版 A+B#
#include<bits/stdc++.h> using namespace std; string add(int A, int B) { int rest= 0; string res= ""; while(A!= 0&& B!= 0) ...
2024-03-20
1
228
题解 | #进制转换#
#include<bits/stdc++.h> using namespace std; // 除法 string divide2(string str10) { int temp= 0;// 上一位计算后的余数 string res= ""; for(int...
2024-03-19
0
245
题解 | #子串计算#
暴力遍历方法 #include<bits/stdc++.h> using namespace std; // 给出一个01字符串(长度不超过100),求其每一个子串出现的次数。 struct node { string sub; int count; node(string str...
2024-03-15
0
254
题解 | #N阶楼梯上楼问题#
#include <bits/stdc++.h> using namespace std; int f(int n) { if(n== 1|| n== 2) { return n; } return f(n-1)+ f(n-2); } int ...
2024-03-15
0
211
题解 | #最大序列和#
关键公式dp[i]=max(dp[i-1]+list[i], list[i])表示至少包含i在内的和最大的子式。 #include <bits/stdc++.h> using namespace std; // dp[i][j]=dp[0][j]-dp[0][i]; int main()...
2024-02-27
0
281
题解 | #计算两个矩阵的乘积#
结果res矩阵记得初始化,否则输出有问题。 #include<bits/stdc++.h> using namespace std; int main() { int a[2][3], b[3][2]; int res[2][2]; for(int i=0; i<2; i...
2024-01-26
0
338
题解 | #进制转换2# 分两步处理即可解决一切进制转换
万变不离其宗,其实就是进制转换。(此方法不使用数字很大的情况,原理一样,但是数字很大只能当作字符串处理。)M进制转10进制:先乘再加10进制转N进制:先模再除 #include<bits/stdc++.h> using namespace std; int charToInt(char...
2024-01-24
0
294
题解 | #简单计算器# #中缀表达式运算#
题解:参考数据结构“中缀表达式”计算方法采用两个栈,一个压数字,一个压运算符。每弹出一个运算符需要弹出两个数字,运算完成后将结果压入数字栈即可。 #include<bits/stdc++.h> #include <iomanip> using namespace std; ...
2024-01-23
0
341
题解 | #浮点数加法# 暴力计算解题
按照平时计算的步骤来1)计算小数位加法2)计算整数位加法(携带小数进位)3)拼接两者,然后输出。tip:计算时两个字符串长的放在左边,方便循环计算。目前好像没看到我这种解法,在这里放一下吧。24/01/22 #include<bits/stdc++.h> using namespace ...
2024-01-22
0
282
首页
上一页
1
2
3
下一页
末页