摘要: #include<bits/stdc++.h>using namespace std;int n;int cv;int a[25];int c[25][25];int bestv=0x3ffff; void backtrack(int t){ if(t>n){ if(cv<bestv) bestv= 阅读全文
posted @ 2020-12-08 15:11 罗霖锦 阅读(129) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h>using namespace std;int bestp;int cv;int cw;int n;int c;struct obj{ int w;//重量 int v;//价值 };obj *s; int bond(int i){ int cleft= 阅读全文
posted @ 2020-12-08 15:10 罗霖锦 阅读(143) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>#include<stack>using namespace std;static const int N=100;static const int white=0;static const int gray=0;static const int black=0; 阅读全文
posted @ 2020-11-04 12:09 罗霖锦 阅读(138) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>#define N 100#define white 0#define gray 1#define black 2using namespace std; int n,M[N][N];int color[N],d[N],f[N],tt; void dfsvisit 阅读全文
posted @ 2020-11-04 11:34 罗霖锦 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 输入案例和输出案例自己搞定 代码 其中sw为交换的次数 即为逆序数 用于体现数列的混乱程度 可以将sw回传 #include<iostream>using namespace std;void bubblesort(int a[],int n) { //int sw = 0; for (int i 阅读全文
posted @ 2020-05-13 19:56 罗霖锦 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 输入 6 5 2 4 6 1 3 输出 1 2 3 4 5 6 代码 #include<iostream>using namespace std;void insertionsort(int a[],int n) { int i, j, temp; for (int i = 1;i < n;i++) 阅读全文
posted @ 2020-05-13 19:38 罗霖锦 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 排序最关键的地方 1复杂度 (复杂度包括时间复杂度与空间复杂度) 2稳定性 关于稳定性的说明:一种排序的算法是否具有稳定性是和自己的代码有关的 在两个相同大小的数字比较的时候 如果你的语句包含了等于这个符号 着两个本来有序的同大小的数字 可能就会被调换位置,而代码中不包含等于这个符号 ,这两个相同大 阅读全文
posted @ 2020-05-13 19:25 罗霖锦 阅读(98) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>#include<cstring>using namespace std;int main() { string s1; string s2; string s3; string s4; cin >> s1 >> s2 >> s4 >> s3 >> s4 >> s 阅读全文
posted @ 2020-05-07 10:43 罗霖锦 阅读(119) 评论(0) 推荐(0) 编辑
摘要: https://blog.csdn.net/qq_35416331/article/details/81059747 阅读全文
posted @ 2020-05-06 23:56 罗霖锦 阅读(73) 评论(0) 推荐(0) 编辑
摘要: https://blog.csdn.net/Sherry_Yue/article/details/88364746 阅读全文
posted @ 2020-04-27 16:59 罗霖锦 阅读(103) 评论(0) 推荐(0) 编辑