05 2023 档案
摘要:def convolution(initial_img, kernal): img = np.zeros((initial_img.shape[0], initial_img.shape[1])).astype(np.uint8) for x in range(1, initial_img.shap
阅读全文
摘要:1. 定义 数组a = [1,2,3,4,5],我们维护一个由前缀的和组成的数组sum,sum[i]表示数组中a[0]~ a[i] 的和。 sum[0] = a[0]sum[1] = a[0] + a[1]sum[2] = a[0] + a[1] + a[2]sum[3] = a[0] + a[1]
阅读全文
摘要:struct node { int l,r; bool operator <(const node &a)const{ return r < a.r; } }a[maxn]; 使用sort时,如果这么定义节点,说明节点要按照从小到大排序(sort中默认从小到大排序);但是同样的代码,如果使用优先队列
阅读全文
摘要:#include<iostream> using namespace std; int a[100][100], sum = 0, minn = 2147483647, i, j, n; int b[100]; void dfs(int dep) { int r; for (r = 1; r <=
阅读全文
摘要:#include <iostream> using namespace std; #define MAX 21 int arr[MAX]; //arr[i]=k,表示在第i行的第k个位置放置一个皇后 int sum;//计数解的个数 int n;//记录几行几列 bool cmp(int row,
阅读全文
摘要:#include <iostream> using namespace std; struct thing { int weight;//物品重量 int value;//物品价值 int number;//物品数量 }; thing things[10];//假设最多有10个物品 int thin
阅读全文
摘要:#include<iostream> using namespace std; int G[50][50]; //保存无向图 int color[50]; //存放每个点的颜色 int sum = 0; //需要的颜色总数 int mins = 999999; //需要的最少的颜色数 int N;
阅读全文
摘要:#include <iostream> using namespace std; struct thing { int weight;//物品重量 int value;//物品价值 int number;//物品序号 }; thing things[10];//假设最多有10个物品 int thin
阅读全文
摘要:#include <iostream> #define INF 9999 //表示无穷大 #define MAXVEX 10 //假设顶点最多不超过10个 using namespace std; struct MGraph { int vertex[MAXVEX];//顶点集 int arc[MA
阅读全文
摘要:#include<iostream> #include<queue> #define INF 1e7 #define MAX 100 using namespace std; int m[MAX][MAX]; //存储城市间的代价 int bestPath[MAX]; //存储最优路径 int be
阅读全文
摘要:#include <iostream> using namespace std; #define MAX 100 struct Node { int isVisit;//记录节点是否被扩展 double w; double v; int level; //记录节点所在的层次 double ub; /
阅读全文