HDU 1040 As Easy As A+B(水~)

来源:互联网 发布:淘宝玉兰油沐浴露 编辑:程序博客网 时间:2024/06/05 09:50

Description
给一个序列,将其升序输出
Input
第一行为用例组数T,每组用例占一行,首先输入序列长度n,之后输入n个整数表该序列
Output
对于每组用例,升序输出序列
Sample Input
2
3 2 1 3
9 1 4 7 2 5 8 3 6 9
Sample Output
1 2 3
1 2 3 4 5 6 7 8 9
Solution
排序裸题
Code

#include<cstdio>#include<iostream>#include<algorithm>using namespace std;int main(){    int t;    scanf("%d",&t);    while(t--)    {        int n;        scanf("%d",&n);        int a[1111];        for(int i=0;i<n;i++)            scanf("%d",&a[i]);        sort(a,a+n);        for(int i=0;i<n;i++)            printf("%d%c",a[i],i==n-1?'\n':' ');    }    return 0;}
0 0
原创粉丝点击