HDU 1040 As Easy As A+B

简单的排序

#include<stdio.h>
#include<string.h>
#include<stack>
#include<algorithm>
using namespace std;

int main()
{
    int t,n,a[1005];
    scanf("%d",&t);
    while(t--)
    {
        int i;
        scanf("%d",&n);
        for(i=0;i<n;i++)
        {
            scanf("%d",&a[i]);
        }
        sort(a,a+n);
        for(i=0;i<n-1;i++)
        {
            printf("%d ",a[i]);
        }
        printf("%d\n",a[n-1]);
    }
    return 0;
}

你可能感兴趣的:(HDU 1040 As Easy As A+B)