摘要: 转自:https://www.linuxidc.com/Linux/2019 06/159104.htm 一、CentOS 7快速开放端口: CentOS升级到7之后,发现无法使用iptables控制Linuxs的端口,baidu之后发现Centos 7使用firewalld代替了原来的iptabl 阅读全文
posted @ 2020-04-03 19:57 lllittletree 阅读(243) 评论(0) 推荐(0) 编辑
摘要: 宿主机使用wifi时虚拟机如何连网 一、宿主机设置 1. 打开网络连接,选择WLAN的属性 共享,如图。 2. 配置虚拟机网络VMnet8,属性 internet协议版本4,配置如图。 二、虚拟机设置 1. 打开VMware Workstation,选择编辑 虚拟网络编辑器,配置如图。 2. 选择虚 阅读全文
posted @ 2020-02-25 17:45 lllittletree 阅读(4136) 评论(0) 推荐(0) 编辑
摘要: ``` 前序遍历:根->左->右 中序遍历:左->根->右 后序遍历:左->右->根 假设树节点的定义如下: struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) {} }; 递归版 //前序遍历 void preorderTrave 阅读全文
posted @ 2019-09-18 11:05 lllittletree 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 1.概念 编辑距离,指的是两个字符串之间,由一个转换成另一个所需的最少编辑操作次数。许可的编辑操作包括:(1)将一个字符替换成另一个字符,(2)插入一个字符,(3)删除一个字符。 相似度,等于“编辑距离+1”的倒数。 2.分析 设有字符串a[0...n],b[0...m]。 (1)当a[i]=b[j 阅读全文
posted @ 2019-09-08 13:36 lllittletree 阅读(1294) 评论(0) 推荐(0) 编辑
摘要: /// 求数组的最大递增子序列/最大递减子序列 include using namespace std; int LIS(vector vec) { int res = 0; int sz = vec.size(); vector dp(sz +1, 0); dp[0] = 1; for(int i 阅读全文
posted @ 2019-09-07 16:18 lllittletree 阅读(552) 评论(0) 推荐(0) 编辑
摘要: ``` /// 换硬币问题 给定1、5、10、25面值的硬币,组成n元共有多少种方法 include using namespace std; int main() { int n = 100; int coins[4] = {1,5,10,25}; int dp[n+1] = {0}; dp[0] 阅读全文
posted @ 2019-09-07 15:26 lllittletree 阅读(117) 评论(0) 推荐(0) 编辑
摘要: ``` /// 求两个字符串的最大公共子序列长度,最长公共子序列则并不要求连续,但要求前后顺序(dp) include using namespace std; void Print(int i, int j){ } int main() { string str1,str2; cin str1 s 阅读全文
posted @ 2019-09-07 15:25 lllittletree 阅读(925) 评论(0) 推荐(0) 编辑
摘要: ``` /// 求最大递增子序列本身,输出路径,子序列不需要连续 #include using namespace std; int LIS(int *p, int length , int* pre, int& nindex); void GetLIS(int *p, int *pre, int nindex, vector& lis); int main() { int a[] = {1,4, 阅读全文
posted @ 2019-09-07 15:24 lllittletree 阅读(985) 评论(0) 推荐(0) 编辑
摘要: ``` include using namespace std; int toInt(char c) { // char c = s; if(c = '0' && c= 'a' && c a b; string str; // 用字符串表示的数字 cin str; bool negative = f 阅读全文
posted @ 2019-09-04 11:49 lllittletree 阅读(1384) 评论(0) 推荐(0) 编辑
摘要: ``` /* 求任意两个不同进制非负整数的转换(2进制~16进制),所给整数在long所能表达的范围之内。 不同进制的表示符号为(0,1,…,9,a,b,…,f)或者(0,1,…,9,A,B,…,F)。 输入 输入只有一行,包含三个整数a,n,b。a表示其后的n 是a进制整数,b表示欲将a进制整数n转换成b进制整数。a,b是十进制整数,2 = #include using namespace st 阅读全文
posted @ 2019-09-04 10:47 lllittletree 阅读(1398) 评论(0) 推荐(0) 编辑