主站
DreamJudge
院校信息
专业题库
模拟考试
机试真题
专业课程
讨论区
兑换中心
登录
注册
发布
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
我能走到对岸吗
2024年5月8日 23:43
整数奇偶排序(多组测试输入) 题解:
P1248
回复 0
|
赞 1
|
浏览 55
#include<bits/stdc++.h> using namespace std; const int N = 15; int num[N]; int og[N], os[N]; int cnt, cnt1, cnt2; int main() { while(cin >> num[cnt]) { if(num[cnt] % 2 == 0) og[cnt1 ++] = num[cnt ++]; else os[cnt2 ++] = num[cnt ++]; ...
sincerely_LM
2021年3月18日 20:30
快排划分思想来进行奇偶排序
P1248
回复 1
|
赞 2
|
浏览 9.5k
#include <iostream> #include <algorithm> using namespace std; bool Compare(const int &a,const int &b){ return a > b;//降序,前面的比后面大 } int main(int argc, char const *argv[]) { int A[100]={0}; while(cin>>A[0]>>A[1]>>A[2]>>A[3]>>A...
小酒
2024年3月17日 21:32
整数奇偶排序 题解:
P1248
回复 0
|
赞 1
|
浏览 200
1248解题思路:sort仍然YYDS #include <bits/stdc++.h> using namespace std; bool cmp(int a,int b) { return a>b; } int main() { int a[105]={0}; int b[105]={0}; for(int i=0;i<10;i++) { scanf("%d",&a[i]); } int j=0; for(int i=0;i<10;i++) { if(a[i]%2==0) ...
泛泛之交
2024年3月16日 16:42
整数奇偶排序 题解:
P1248
回复 0
|
赞 0
|
浏览 253
#include <bits/stdc++.h> using namespace std; bool cmp(int a,int b){ return a>b; } int main() { int n=10; int a[10]; while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4]>>a[...
easymoney
2024年3月14日 16:17
整数奇偶排序 题解:(20%)
P1248
回复 1
|
赞 0
|
浏览 172
#include <stdio.h> #include <iostream> #include <algorithm> #include <string> using namespace std; bool cmp(int a,int b){ if (a % 2 == b % 2) { if (a % 2 == 1) &nbs...
huanghu
2024年3月14日 14:34
整数奇偶排序 题解:
P1248
回复 0
|
赞 0
|
浏览 163
#include<stdio.h> #include<iostream> #include<algorithm> using namespace std; bool cmp(int a,int b){ if(a%2!=b%2){ return a%2>b%2; }else{ if(a%2==1){ return a>b; }else{ return a<b; } } ...
红毛舒肤佳
2024年3月10日 20:36
整数奇偶排序 题解:C++
P1248
回复 0
|
赞 0
|
浏览 246
#include <bits/stdc++.h> using namespace std; bool cmp(int a,int b){ if(a%2==1&&b%2==1) return a>b; else if(a%2==0&&b%2==0) return a<b; else return (a%2)>(b%2); } int main(){ int a[11]; while(cin>>a[0]&...
FIVEszc
2024年3月10日 11:21
整数奇偶排序 题解:C++
P1248
回复 0
|
赞 0
|
浏览 190
#include <bits/stdc++.h> using namespace std; bool comp (int lhs,int rhs) { if(lhs%2&&rhs%2&&lhs>rhs) return true; else if(lhs%2&&rhs%2==0) return true; else if(lhs%2==0&&rhs%2==0&&lhs<rhs) return t...
开心的傻狗
2024年3月5日 21:39
整数奇偶排序 题解:sort函数解决
P1248
回复 0
|
赞 0
|
浏览 229
#include<iostream> #include<bits/stdc++.h> using namespace std; bool cmp(int a,int b){ if(a%2==0&&b%2==0){ return a<b; } else if(a%2==1&&b%2==1){ return a>b; } else{ return (a%2)>(b%2); } } int main(){ int a[105]={0}; for(int i=...
lingdongyang
2024年3月5日 21:04
整数奇偶排序 题解:
P1248
回复 0
|
赞 0
|
浏览 278
#include<stdio.h> int k1 = 0;//偶数个数 int k2 = 0;//奇数个数 int main() { int s[105]; int j[105];//奇数 int o[105];//偶数 for (int i = 0; i < 10; i++) { scanf("%d", &s[i]);//要加取地址符号 } for (int i = 0; i < 10; i++) {//偶数 if (s[i] % 2 == 0) { o[k1] = s[i]; k1...
1
2
3
题目
整数奇偶排序
题解数量
24
发布题解
热门题解
1
两个数组
2
快排划分思想来进行奇偶排序
3
整数奇偶排序 题解:用俩数组分别打包奇偶数,再分别输出
4
整数奇偶排序 题解:一个数组,sort巧妙解决
5
整数奇偶排序(多组测试输入) 题解:
6
整数奇偶排序 题解:
7
cmp函数的一个特性就是, 如果return false, 那么函数就会将他们互换位置, return true就会保持原来位置不变。
8
多级排序思想
9
整数奇偶排序 题解:c++ sort函数解决
10
亢龙有悔