CDZSC_2015寒假新人(1)——基础 D

Description

These days, I am thinking about a question, how can I get a problem as easy as A+B? It is fairly difficulty to do such a thing. Of course, I got it after many waking nights.        Give you some integers, your task is to sort these number ascending (升序).        You should know how easy the problem is now!        Good luck!

Input

Input contains multiple test cases. The first line of the input is a single integer T which is the number of test cases. T test cases follow. Each test case contains an integer N (1<=N<=1000 the number of integers to be sorted) and then N integers follow in the same line.         It is guarantied that all integers are in the range of 32-int.

Output

For each case, print the sorting result, and one line one case.

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

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
#ifdef CDZSC_OFFLINE
    freopen("in.txt","r",stdin);
#endif
    int t,n,a[1010],i;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d",&n);
        for(i=0; i<n; i++)
        {
            scanf("%d",&a[i]);
        }
        sort(a,a+n);
        for(i=0; i<n; i++)
        {
            if(i!=0)
            {
                printf(" ");
            }
            printf("%d",a[i]);
        }
        printf("\n");
    }
    return 0;
}

时间: 2024-11-05 23:32:05

CDZSC_2015寒假新人(1)——基础 D的相关文章

CDZSC_2015寒假新人(1)——基础 I

Description “Point, point, life of student!” This is a ballad(歌谣)well known in colleges, and you must care about your score in this exam too. How many points can you get? Now, I told you the rules which are used in this course. There are 5 problems i

CDZSC_2015寒假新人(1)——基础 B

Description The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 seconds to move the elevator up one floor

CDZSC_2015寒假新人(1)——基础 G

Description Ignatius likes to write words in reverse way. Given a single line of text which is written by Ignatius, you should reverse all the words and then output them. Input The input contains several test cases. The first line of the input is a s

CDZSC_2015寒假新人(1)——基础 E

Description Julius Caesar lived in a time of danger and intrigue. The hardest situation Caesar ever faced was keeping himself alive. In order for him to survive, he decided to create one of the first ciphers. This cipher was so incredibly sound, that

CDZSC_2015寒假新人(1)——基础 F

Description An inch worm is at the bottom of a well n inches deep. It has enough energy to climb u inches every minute, but then has to rest a minute before climbing again. During the rest, it slips down d inches. The process of climbing and resting

CDZSC_2015寒假新人(1)——基础 C

Description FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean.        The warehouse has N rooms. The i-th room contains J[i] pounds of JavaBeans and requires F[i] pounds

CDZSC_2015寒假新人(1)——基础 H

Description Ignatius was born in a leap year, so he want to know when he could hold his birthday party. Can you tell him?        Given a positive integers Y which indicate the start year, and a positive integer N, your task is to tell the Nth leap ye

CDZSC_2015寒假新人(2)——数学 - O

Description 当寒月还在读大一的时候,他在一本武林秘籍中(据后来考证,估计是计算机基础,狂汗-ing),发现了神奇的二进制数. 如果一个正整数m表示成二进制,它的位数为n(不包含前导0),寒月称它为一个n二进制数.所有的n二进制数中,1的总个数被称为n对应的月之数. 例如,3二进制数总共有4个,分别是4(100).5(101).6(110).7(111),他们中1的个数一共是1+2+2+3=8,所以3对应的月之数就是8. Input 给你一个整数T,表示输入数据的组数,接下来有T行,每

CDZSC_2015寒假新人(4)——搜索 A

Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Description Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number line and