首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
诗岸梦行舟
2025年3月10日 14:22
排序 题解:笨蛋算法
P1010
回复 0
|
赞 10
|
浏览 1.4k
#include<stdio.h> #include<stdlib.h> #include<string.h> int main(){ int n; scanf("%d",&n); int a[1001]; for(int i=0;i<n;i++){ scanf("%d",&a[i]); } int low=0; int high=n-1; while(low<high){ while(low<high&&a[high]%2==0) high--;...
jaygee_
2025年3月3日 09:13
排序 题解:
P1010
回复 0
|
赞 15
|
浏览 1.3k
快速排序改比较方式 #include <bits/stdc++.h> using namespace std; const int N = 100005; int a[N]; bool cmp(int x, int y) { // 奇数在前,偶数在后 if (x % 2 != y % 2) { return x % 2 > y % 2; // 奇数优先 } // 同奇偶性时,按从小到大排序 return x < y; } void quickSort(int l...
chenxx
2025年2月28日 17:36
排序 题解:
P1010
回复 0
|
赞 5
|
浏览 1.1k
#include <bits/stdc++.h> using namespace std; bool compare(const int& n1,const int& n2){ if((n1%2==1)&&(n2%2==0)) return true; else if((n1%2==0)&&(n2%2==1)) return false; else return n1<n2; } ...
MEGURI
2025年1月11日 20:38
排序 题解:拆分数组分别进行冒泡排序输出
P1010
回复 0
|
赞 33
|
浏览 1.5k
#include<stdio.h> int main() { int n = 0; scanf("%d", &n); int i = 0; int j = 0; int k = 0; int x = 0; int a[1000]; &nbs...
hellokitty1679
2024年9月8日 14:59
排序 题解:C
P1010
回复 0
|
赞 12
|
浏览 3.0k
#include<stdio.h> #include<stdlib.h> int cmp (const void * a, const void * b) { return ( *(int*)a - *(int*)b ); } int main(void) { int a[1000],b[1000]; int X,n; int m=0,N=0; scanf("...
morning
2024年8月9日 21:57
排序 题解:运用自带sort函数+定义比较方法cmp解决
P1010
回复 0
|
赞 43
|
浏览 1.7k
#include<bits/stdc++.h> using namespace std; bool cmp(int a,int b){ if(a%2 != b%2)//不同奇偶 return a%2 > b%2; else return a<b; } int main(){ int n; cin>>n; ...
18919717626
2024年6月30日 15:26
排序 题解:sort
P1010
回复 0
|
赞 11
|
浏览 1.4k
#include <iostream> #include <algorithm> using namespace std; const int N = 1010; int s[N]; int n; int main(){ cin >> n; for(int i = 0;i < n;i ++)cin >> s[i]; sort(s,s + n); for(int i = 0;i < n;i ++){ if(s[i] % 2 ){ cout <<...
220621ybx
2024年5月30日 19:56
排序 题解:
P1010
回复 0
|
赞 7
|
浏览 1.3k
#include<stdio.h> int n,a[1005],ji[1005],ou[1005]; //核心在排序上面,使用的冒泡排序 void sort(int *arr,int size){ for(int i = 0;i<size;i++){ for(int j = 0;j<size-1-i;j++){ if(arr[j] > arr[j+1]){ int temp; temp = arr[j+1]; arr[j+1] = arr[j]; arr[j] = temp; } ...
Candour
2024年4月20日 00:12
排序 题解:
P1010
回复 1
|
赞 3
|
浏览 1.2k
#include<bits/stdc++.h> using namespace std; const int N = 1010; int a[N]; int n; int main() { cin >> n; for(int i = 0; i < n; i ++) cin >> a[i]; sort(a, a + n); for(int i = 0; i < n; i ++) if(a[i] % 2) ...
Keving_CK
2024年3月31日 16:41
排序 题解:冒泡排序
P1010
回复 0
|
赞 7
|
浏览 1.7k
#include<stdio.h> //冒泡排序 void BSort(int A[],int n){ int temp; for(int i=0;i<n-1;i++){ for(int j=n-1;j>i;j--) if(A[j-1]>A[j]){ &nbs...
1
2
3
4
...
6
题目
排序
题解数量
53
发布题解
在线答疑
热门题解
1
排序 题解:运用自带sort函数+定义比较方法cmp解决
2
排序 题解:拆分数组分别进行冒泡排序输出
3
排序 题解:
4
排序 题解:采用冒泡排序将奇数分在左边,偶数在右边,然后找到奇偶分界点,后stable_sort
5
排序 题解:
6
排序 题解:c++,三种方法
7
排序 题解:qsort
8
排序 题解:C
9
排序 题解:sort
10
排序 题解:棒棒算法