蓝桥杯题目
来源:互联网 发布:网络大电影收片 编辑:程序博客网 时间:2024/06/05 00:47
题目:
问题描述
给定一个长度为n的数列,将这个数列按从小到大的顺序排列。1<=n<=200
输入格式
第一行为一个整数n。
第二行包含n个整数,为待排序的数,每个整数的绝对值小于10000。
第二行包含n个整数,为待排序的数,每个整数的绝对值小于10000。
输出格式
输出一行,按从小到大的顺序输出排序后的数列。
样例输入
5
8 3 6 4 9
8 3 6 4 9
样例输出
3 4 6 8 9
自己写的程序:
#include<stdio.h>int main(){int n ;int i ;int j ;scanf("%d",&n) ;int a[200] ;for(i=0;i<n;i++){ scanf("%d",&a[i]) ;}for(i=0;i<n-1;i++){int min=i ;int temp ;for(j=i+1;j<n;j++){if(a[min]>a[j]){min = j ;}}if(min != i){temp = a[i] ;a[i] = a[min] ;a[min] = temp ; }}for(i = 0;i < n;i++){printf("%d ",a[i]) ;}return 0 ;}
0 0
- 蓝桥杯题目
- 题目
- 题目
- 题目
- 题目
- 题目
- 题目
- 题目
- 题目
- 题目
- 题目
- 题目
- 题目
- 题目
- 题目
- 题目
- 题目
- 题目
- Servlet乱码解决
- 1497: [NOI2006]最大获利
- Unity NGUI 关于选中UI
- 读取Java中配置文件的两种方式
- Search for a Range
- 蓝桥杯题目
- Unity NGUI UIDrag Object
- java final关键字的理解与使用方法总结二
- Leetcode-4 Median of Two Sorted Arrays
- 类别添加UIImage的裁剪方法
- 编译警告:warning C4996 与 Security Enhancements in the CRT
- C语言 - 替换字符函数使用
- apache You don't have permission to access /test.php on this server解决方法
- C 数组与链表的区别