整数奇偶排序
来源:互联网 发布:重庆指尖网络 编辑:程序博客网 时间:2024/05/22 02:19
#include<bits/stdc++.h>
using namespace std;
int a[101];
int main()
{
int h=0,t=9;
for(int i=0;i<10;i++)
{
int x;
cin>>x;
if(x%2==1)a[h++]=-x;
else a[t--]=x;
}
sort(a,a+h);
sort(a+h,a+10);
for(int i=0;i<h;i++)cout<<-a[i]<<" ";
for(int i=h;i<10;i++)cout<<a[i]<<" ";
return 0;
}
using namespace std;
int a[101];
int main()
{
int h=0,t=9;
for(int i=0;i<10;i++)
{
int x;
cin>>x;
if(x%2==1)a[h++]=-x;
else a[t--]=x;
}
sort(a,a+h);
sort(a+h,a+10);
for(int i=0;i<h;i++)cout<<-a[i]<<" ";
for(int i=h;i<10;i++)cout<<a[i]<<" ";
return 0;
}
阅读全文
1 0
- 整数奇偶排序
- 整数奇偶排序
- 整数奇偶排序
- 整数奇偶排序
- 整数奇偶排序
- 整数奇偶排序
- 整数奇偶排序
- 整数奇偶排序
- 06:整数奇偶排序
- 题目1117:整数奇偶排序
- 题目1117:整数奇偶排序
- 题目1117:整数奇偶排序
- 题目1117:整数奇偶排序
- 题目1117:整数奇偶排序
- 题目1117:整数奇偶排序
- 【九度】题目1117:整数奇偶排序
- 题目1117:整数奇偶排序 C++/Java
- 九度oj-1117-整数奇偶排序
- idea安装配置maven
- acm二进制运算技巧
- [ICLR2015]Neural Machine Translation by Jointly Learning to Align and Translate
- python的三种字符串格式化方法
- JS_绘图_canvas
- 整数奇偶排序
- 网络编程服务器与客户端实现代码详解
- framework watchdog源码分析
- 一文读懂Shell脚本中循环语句for,while,until用法
- python入门(十):文件的操作详解
- 八皇后问题
- 合影效果
- C语言数据结构2——双向链表的实现
- 汇编中loop格式用法分析