- 博客(5)
- 收藏
- 关注
原创 2019蓝桥杯填空题
2019l蓝桥杯填空题#include<iostream>using namespace std;int main(){ int cnt=0; char str[30][50]; for(int i=0;i<30;i++) for (int j = 0; j < 50; j++) { cin >> str[i][j]; } for (int i = 0; i < 30; i++) { for (int j = 0; j &
2022-02-23 20:20:20
286
原创 枚举解决01背包问题
这个与上一篇解决01背包问题的方法相比优点: 代码更为简洁时间复杂度更低缺点:不易实现怎样装包的输出//暴力解决01背包问题#include<iostream>#include<algorithm>using namespace std;#define n 1100int f[n][n];//记录背包价值int p[n][n];//记录背包重量int v[n], m[n];int main(){ int N, V; cout << "请
2022-01-29 18:10:11
1478
原创 广度优先遍历(广搜)解决01背包问题
搞了好多天才调出来,一个if语句中的关系运算符==和一个写错的数组名就困扰了我大半天,可能会有一些不合适的地方,希望大佬们看到可以多多指教。//广搜解决01背包问题#include<iostream>#include<queue>using namespace std;int N, V;//搜索树结点定义struct Node{ int *x = new int[N]; int v;//当前背包体积 int m;//当前背包价值 int k;//当前所属搜
2022-01-28 17:33:54
901
原创 三维数组中以行优先和以列优先处于相同存储位置的判别
#include<iostream>using namespace std;//n*m*p的三维数组创建函数void Biuld(int n, int m, int p){ int i, j, k, temp = 0; //动态定义三维数组 int *A = new int[n*m*p]; int *B = new int[n*m*p]; //以行优先 for (k = 0; k < p; k++) for (i = 0; i < n; i++) fo.
2022-01-24 21:38:24
2009
原创 c++二进制与十进制的相互转换
#include<iostream>#include<vector>#include<string>using namespace std;vector<int> a;//十进制转二进制函数void TEN2T(int x){ int n; do { a.push_back(x % 2); x /= 2; } while (x != 0); for (int i = a.si...
2022-01-23 18:17:16
2785
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅