张雅芳
张雅芳
全部文章
分类
归档
标签
去牛客网
登录
/
注册
张雅芳的博客
全部文章
(共29篇)
题解 | #称砝码#
#include <iostream> #include <vector> #include <set> using namespace std; //将个数和重量全部组合一次,组合结果存入set中,会自动去重,最...
C++
2022-11-15
0
193
题解 | #输出单向链表中倒数第k个结点#
#include <iostream> #include <forward_list> using namespace std; int main() { int&n...
C++
2022-11-15
0
290
题解 | #公共子串计算#
#include <iostream> #include <vector> using namespace std; int main() { string ...
C++
2022-11-15
0
249
题解 | #名字的漂亮度#
#include <bits/stdc++.h> #include <vector> using namespace std; //统计字符出现次数,再按出现次数从多到少依次乘上26,25,24...1。 int main()...
C++
2022-11-15
0
271
题解 | #迷宫问题#
#include using namespace std; //每个点都有两种走法:在有路的情况下,向右(i,j+1),向下(i+1,j),到(n-1,m-1)成功 //用数组来记录路径 vector> route; vector> temp_path; vector> best...
C++
2022-11-15
0
248
题解 | #记票统计#
#include <bits/stdc++.h> #include <vector> using namespace std; int main() { int&nb...
C++
2022-11-14
0
222
题解 | #走方格的方案数#
#include <iostream> using namespace std; //递归:每一步都有两种走法,向下走(i+1,j)或者向右走(i,j+1);在边界除外,边界只有1种走法 int recursion(int i,int&n...
C++
递归
2022-11-14
1
208
题解 | #放苹果#
思路:递归。太妙了!将m个苹果放入n个篮子里,允许有的篮子空着这个事件Z,包含两个互斥事件A和B,即A并B=U,A交B为空集;其中事件A为有的篮子空着,即至少有1个篮子空着;B为所有篮子都不空,即每个篮子都至少有1个苹果。 令(m,n)表示将m个苹果放入n个盘子中的摆放方法总数。 ...
C++
2022-11-11
0
477
题解 | #查找组成一个偶数最接近的两个素数#
优化思路:因为差值最小的两个数一定集中在中间,所以可以直接从中间开始分奇数个和偶数个来讨论 #include <iostream> using namespace std; int isPrime(int num){ &n...
C++
2022-11-10
0
249
题解 | #统计每个月兔子的总数#
思路一:递归 #include <iostream> using namespace std; int getsum(int n){ if(n==1||n==2) &nbs...
C++
2022-11-09
0
248
首页
上一页
1
2
3
下一页
末页