摘要:
struct node { int l,r; bool operator <(const node &a)const{ return r < a.r; } }a[maxn]; 使用sort时,如果这么定义节点,说明节点要按照从小到大排序(sort中默认从小到大排序);但是同样的代码,如果使用优先队列 阅读全文
posted @ 2023-05-01 22:31
Jocelynn
阅读(142)
评论(0)
推荐(0)
摘要:
#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 <= 阅读全文
posted @ 2023-05-01 22:00
Jocelynn
阅读(83)
评论(0)
推荐(0)
摘要:
#include <iostream> using namespace std; #define MAX 21 int arr[MAX]; //arr[i]=k,表示在第i行的第k个位置放置一个皇后 int sum;//计数解的个数 int n;//记录几行几列 bool cmp(int row, 阅读全文
posted @ 2023-05-01 21:59
Jocelynn
阅读(38)
评论(0)
推荐(0)
摘要:
#include <iostream> using namespace std; struct thing { int weight;//物品重量 int value;//物品价值 int number;//物品数量 }; thing things[10];//假设最多有10个物品 int thin 阅读全文
posted @ 2023-05-01 21:58
Jocelynn
阅读(122)
评论(0)
推荐(0)
摘要:
#include<iostream> using namespace std; int G[50][50]; //保存无向图 int color[50]; //存放每个点的颜色 int sum = 0; //需要的颜色总数 int mins = 999999; //需要的最少的颜色数 int N; 阅读全文
posted @ 2023-05-01 21:57
Jocelynn
阅读(146)
评论(0)
推荐(0)
摘要:
#include <iostream> using namespace std; struct thing { int weight;//物品重量 int value;//物品价值 int number;//物品序号 }; thing things[10];//假设最多有10个物品 int thin 阅读全文
posted @ 2023-05-01 21:53
Jocelynn
阅读(153)
评论(0)
推荐(0)
摘要:
#include <iostream> #define INF 9999 //表示无穷大 #define MAXVEX 10 //假设顶点最多不超过10个 using namespace std; struct MGraph { int vertex[MAXVEX];//顶点集 int arc[MA 阅读全文
posted @ 2023-05-01 21:52
Jocelynn
阅读(151)
评论(0)
推荐(0)
摘要:
#include<iostream> #include<queue> #define INF 1e7 #define MAX 100 using namespace std; int m[MAX][MAX]; //存储城市间的代价 int bestPath[MAX]; //存储最优路径 int be 阅读全文
posted @ 2023-05-01 21:40
Jocelynn
阅读(529)
评论(0)
推荐(0)
摘要:
#include <iostream> using namespace std; #define MAX 100 struct Node { int isVisit;//记录节点是否被扩展 double w; double v; int level; //记录节点所在的层次 double ub; / 阅读全文
posted @ 2023-05-01 21:38
Jocelynn
阅读(162)
评论(0)
推荐(0)
浙公网安备 33010602011771号