2017年3月19日

快速排序

摘要: #include #include using namespace std; void qsort(int a[],int l,int r) { if(l<r) { int mid = (l+r)/2,i,las = l; swap(a[l],a[mid]); for(int i=l+1;i<=r;i++) ... 阅读全文

posted @ 2017-03-19 21:45 九月旧约 阅读(120) 评论(0) 推荐(0) 编辑

归并排序

摘要: #include #include #include #include #define maxn 1010 using namespace std; void merge(int sr[],int tr[],int i,int m,int n) { /* 将有序的sr[i..m]和sr[m+1..n]归并为有序的tr[i..n] */ int j,k,l; for(j=m+1,k... 阅读全文

posted @ 2017-03-19 21:03 九月旧约 阅读(110) 评论(0) 推荐(0) 编辑

堆排序

摘要: #include #include #include #include using namespace std; int a[1010]; void heapadjust(int s,int m) {//建立新堆 int temp,j; temp = a[s];//找最大值 for(j=2*s;j=a[j]) break; a[s]... 阅读全文

posted @ 2017-03-19 20:19 九月旧约 阅读(108) 评论(0) 推荐(0) 编辑

希尔排序

摘要: #include #include #include #include using namespace std; int main() { int n; cin >> n; int a[n]; memset(a,0,sizeof(a)); for(int i=1;i> a[i]; int len = n; while(len>1) ... 阅读全文

posted @ 2017-03-19 19:31 九月旧约 阅读(95) 评论(0) 推荐(0) 编辑

直接插入排序

摘要: #include #include #include #include using namespace std; int main() { int n; cin >> n; int a[n]; memset(a,0,sizeof(a)); for(int i=1;i> a[i]; for(int i=2;ia[0];j--) ... 阅读全文

posted @ 2017-03-19 19:09 九月旧约 阅读(85) 评论(0) 推荐(0) 编辑

优化 冒泡排序模板

摘要: #include #include #include #include using namespace std; int main() { int n; cin >> n; int a[n]; for(int i=1;i> a[i]; int flag = 1; for(int i=1;i=i;j--) { ... 阅读全文

posted @ 2017-03-19 17:50 九月旧约 阅读(91) 评论(0) 推荐(0) 编辑

选择排序模板

摘要: #include #include #include #include using namespace std; int main() { int n; cin >> n; int a[n]; for(int i=1;i> a[i]; int minn; for(int i=1;ia[j]) minn = j; ... 阅读全文

posted @ 2017-03-19 17:49 九月旧约 阅读(176) 评论(0) 推荐(0) 编辑

天梯杯 L2-005. 集合相似度

摘要: L2-005. 集合相似度 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 陈越 时间限制 400 ms 时间限制 400 ms 内存限制 65536 kB 内存限制 65536 kB 代码长度限制 8000 B 代码长度限制 800 阅读全文

posted @ 2017-03-19 16:49 九月旧约 阅读(435) 评论(0) 推荐(0) 编辑

天梯杯 L2-003. 月饼

摘要: L2-003. 月饼 时间限制 100 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 陈越 时间限制 100 ms 时间限制 100 ms 内存限制 65536 kB 内存限制 65536 kB 代码长度限制 8000 B 代码长度限制 8000 B 阅读全文

posted @ 2017-03-19 11:28 九月旧约 阅读(386) 评论(0) 推荐(0) 编辑

天梯杯 L2-008. 最长对称子串

摘要: L2-008. 最长对称子串 时间限制 100 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 陈越 时间限制 100 ms 时间限制 100 ms 内存限制 65536 kB 内存限制 65536 kB 代码长度限制 8000 B 代码长度限制 80 阅读全文

posted @ 2017-03-19 10:06 九月旧约 阅读(1894) 评论(0) 推荐(0) 编辑

导航