文章分类 - C/C++算法基础
摘要:给定一个高精度数和一个低精度数(在int范围),求相除的结果的整数部分和余数 #define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<vector> #include<string> using namespace std; typed
阅读全文
摘要:#include<iostream> #include<vector> #include<string> using namespace std; typedef vector<int> ve;//用ve代替vector<int>,避免麻烦 ve mul(ve &A, int b) { int t
阅读全文
摘要:#include<iostream> #include<vector> #include<string> using namespace std; typedef vector<int> ve;//用ve代替vector<int>,避免麻烦 bool jug(ve& A, ve& B)//判断A,B
阅读全文
摘要:#include<iostream> #include<vector> #include<string> using namespace std; typedef vector<int> ve;//用ve代替vector<int>,避免后续麻烦 ve add(ve &A, ve &B) { ve C
阅读全文
摘要:归并排序(Merge Sort)是利用归并的思想实现的排序方法,该算法采用经典的分治(divide-and-conquer)策略将问题分成一些小的问题然后递归求解,即分而治之。 假如一个数组为下所示: 2 1 3 7 5 4 归并算法先将数组二分: 2 1 3 7 5 4 之后通过递归再将每部分二分
阅读全文
摘要:快速排序 1 #include<iostream> 2 #include<algorithm> 3 4 using namespace std; 5 6 int arr[100]; 7 8 void qu_sort(int l, int r)//二分 9 { 10 if (l >= r)
阅读全文

浙公网安备 33010602011771号