HDU 1040 As Easy As A+B (排序。。。水题)

Posted dwtfukgv

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HDU 1040 As Easy As A+B (排序。。。水题)相关的知识,希望对你有一定的参考价值。

题意:给定n个数,让你从小到大排序。

析:不说什么了。

代码如下:

#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>

using namespace std;
const int maxn = 1000 + 5;
int a[maxn];

int main(){
    int T, n;  cin >> T;
    while(T--){
        scanf("%d", &n);
        for(int i = 0; i < n; ++i)  scanf("%d", &a[i]);
        sort(a, a+n);

        printf("%d", a[0]);
        for(int i = 1; i < n; ++i)
            printf(" %d", a[i]);
        printf("\n");
    }

    return 0;
}

 

以上是关于HDU 1040 As Easy As A+B (排序。。。水题)的主要内容,如果未能解决你的问题,请参考以下文章

HDU1040: As Easy As A+B

HDU 1040 As Easy As A+B (排序。。。水题)

HDU 1040.As Easy As A+B排序如题(水!水!水!)8月24

BNUOJ52317 As Easy As Possible(树上倍增)

hdu1040

Python库 - import matplotlib.pyplot as plt 报错问题