随笔分类 -  C++ / 排序

摘要:#include <iostream> #include <cmath> using namespace std; int main(){ int n; cin>>n; int a[n+5]; for(int i = 0;i<n;i++){ cin>>a[i]; } for(double i = n 阅读全文
posted @ 2024-04-20 09:25 王一行(小号) 阅读(4) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; int a[n+5]; for(int i = 1;i<=n;i++){ cin>>a[i]; } int j; for(int i = 2;i<=n;i 阅读全文
posted @ 2024-04-05 09:43 王一行(小号) 阅读(8) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; int a[n+5]; for(int i = 0;i<n;i++){ cin>>a[i]; } int j1; for(int i = 0;i<n;i+ 阅读全文
posted @ 2024-04-05 08:55 王一行(小号) 阅读(4) 评论(0) 推荐(0) 编辑
摘要:#include <iostream> using namespace std; int main(){ int n; cin>>n; int a[n+5]; for(int i = 0;i<n;i++){ cin>>a[i]; } for(int i = 0;i<n-1;i++){ for(int 阅读全文
posted @ 2024-04-05 08:54 王一行(小号) 阅读(3) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; void ksort(int *a,int l,int r){ int mid = a[(l+r)/2]; int i = l,j = r; do{ while(a[i]<mid){ i++; } while 阅读全文
posted @ 2024-03-26 21:47 王一行(小号) 阅读(3) 评论(0) 推荐(0) 编辑
摘要:主函数 #include <bits/stdc++.h> #include "Sort.h" using namespace std; int main(){ int n; cin>>n; Sort.N = n; Sort.Cin(); Sort.Cout(); return 0; } 副函数 cl 阅读全文
posted @ 2024-01-28 11:18 王一行(小号) 阅读(4) 评论(0) 推荐(0) 编辑