数据排序
来源:互联网 发布:道亨软件 编辑:程序博客网 时间:2024/05/18 23:26
/*************************************************
File name: 考试// 文件名
Author: NBS//作者
Version:2.2.2 //版本
Date: 2017.03.26// 日期
Description: 数据排序// 用于详细说明此程序文件完成的主要功能,与其他模块
*************************************************/
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<iomanip>
#include<cstdlib>
using namespace std;
int a[110];
int main()
{
int n,t;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i];
}
for(int i=1;i<=n;i++)
{
for(int j=i+1;j<=n;j++)
{
if(a[i]<a[j])
{
t=a[i]; a[i]=a[j]; a[j]=t;}
}
}
for(int i=1;i<=n;i++)
{
if(a[i]%2==1)
printf("%d ",a[i]);
}
for(int i=n;i>=1;i--)
{
if(a[i]%2==0)
{
printf("%d ",a[i]);
}
}
return 0;
File name: 考试// 文件名
Author: NBS//作者
Version:2.2.2 //版本
Date: 2017.03.26// 日期
Description: 数据排序// 用于详细说明此程序文件完成的主要功能,与其他模块
*************************************************/
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<iomanip>
#include<cstdlib>
using namespace std;
int a[110];
int main()
{
int n,t;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i];
}
for(int i=1;i<=n;i++)
{
for(int j=i+1;j<=n;j++)
{
if(a[i]<a[j])
{
t=a[i]; a[i]=a[j]; a[j]=t;}
}
}
for(int i=1;i<=n;i++)
{
if(a[i]%2==1)
printf("%d ",a[i]);
}
for(int i=n;i>=1;i--)
{
if(a[i]%2==0)
{
printf("%d ",a[i]);
}
}
return 0;
0 0
- 数据排序
- 数据排序
- 数据排序
- 排序数据
- 数据排序.
- 排序数据
- 数据排序
- 数据排序(排序小结)
- 数据排序:冒泡排序
- 数据汇总加排序
- SQL数据排序 (转贴)
- xml数据分组排序
- 实现数据随机排序
- VB 数据排序
- 数据汇总加排序
- 数据汇总加排序
- 数据汇总加排序
- 数据汇总加排序
- Monash Bridging Course
- spring的DI/IOC机制
- delphi RestClient 用法1
- linux 误删除Oracle数据文件恢复
- Hadoop-2.7.3环境下Hive-2.1.1安装配置。
- 数据排序
- 计161_Problem : 字符串操作一(串)
- 使用kaptcha生成验证码
- logstash5.x 启动异常
- oracle分页的两种方式
- Tomcat安装与部署
- 使用eClipse将java源码打包成jar包
- 丢手帕问题 (约瑟夫问题)
- Ubuntu系统性能检测软件--Le测评