As Easy As A+B

As Easy As A+B

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 2882 Accepted Submission(s): 1357

Problem 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

Author

lcy

很简单的一道题,只要注意一下格式就OK了。

#include<stdio.h>
#include<stdlib.h>

int cmp(const void *a,const void *b)
{
    return *(int *)a - *(int *)b;//由小到大排序
}

int main()
{
    int n,m;
    int i;
    int data[1001]={0};

    scanf("%d",&n);
    while(n--)
    {
        scanf("%d",&m);
        for(i=0;i<m;i++)
        {
            scanf("%d",&data[i]);
        }
        qsort(data,m,sizeof(int),cmp);
        for(i=0;i<m-1;i++)
        {
            printf("%d ",data[i]);
        }
         printf("%d\n",data[i]);
    }
    return 0;
}
时间: 2024-12-14 21:17:12

As Easy As A+B的相关文章

地理数据可视化:Simple,Not Easy

如果要给2015年的地理信息行业打一个标签,地理大数据一定是其中之一.在信息技术飞速发展的今天,“大数据”作为一种潮流铺天盖地的席卷了各行各业,从央视的春运迁徙图到旅游热点预测,从大数据工程师奇货可居到马云布道“DT”时代,“大数据”被推到了一个前所未有的高度,连国家领导人出访演讲都言必称大数据.地理信息数据天生具有大数据属性,作为整天和地理信息数据打交道的地信人自然不甘落后,地理大数据概念脱颖而出. 地理大数据是什么?大体来说就是把社会经济.自然资源.商业信息等但凡具有一点空间维度的数据一股脑

哈理工2015暑假训练赛BNU16488 Easy Task(简单题)

A - Easy Task Time Limit:2000MS    Memory Limit:65536KB    64bit IO Format:%lld & %llu SubmitStatusPracticeZOJ 2969 Description Calculating the derivation of a polynomial is an easy task. Given a function f(x) , we use (f(x))' to denote its derivatio

Designing CSS Layouts With Flexbox Is As Easy As Pie

This article is an updated excerpt of the chapter "Restyle, Recode, Reimagine With CSS3″ from our Smashing Book #3, written by Lea Verou and David Storey. - Ed. Flexible box layout (or flexbox) is a new box model optimized for UI layout. As one of th

27. Remove Element【easy】

27. Remove Element[easy] Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for another array, you must do this in place with constant memory. The order of elements can be ch

26. Remove Duplicates from Sorted Array【easy】

26. Remove Duplicates from Sorted Array[easy] Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this in place with consta

Jquery Easy UI 实现页面的Loading效果(类似于Android的ProgressDialog)

前言 很常用的一种前端效果,比如当用户点击网页的某个按钮发送了一条异步请求,如果响应时间过长容易导致用户重复点击,一方面影响用户体验一方面容易造成不必要的服务端压力,Easy UI有现成的mask样式,简单封装一下就可以使用,之前查阅搜集了相关资料和文章,发现都介绍的都不是很完整,所以本篇blog就完整的记录一下通过Easy UI快速实现这种效果以及如何集成到项目中. 引入.封装和调用 首先当然是在我们的项目中集成jquery以及easyui的相关资源包,除了jquery的核心js文件,easy

Easy VPN

Easy VPN路由器上配置 R1(config)#aaa new-model 定义AAA R1(config)#aaa authentication login vpn_authen localR1(config)#aaa authorization network vpn_author localR1(config)#username cisco password ciscoR1(config)#crypto isakmp policy 10 定义一阶段策略的SA参数 R1(config-i

an easy problem(贪心)

An Easy Problem Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8333   Accepted: 4986 Description As we known, data stored in the computers is in binary form. The problem we discuss now is about the positive integers and its binary form.

C语言 &#183; 交换Easy

算法提高 交换Easy 时间限制:1.0s   内存限制:512.0MB 问题描述 给定N个整数组成的序列,每次交换当前第x个与第y个整数,要求输出最终的序列. 输入格式 第一行为序列的大小N(1<=N<=1000)和操作个数M(1<=M<=1000). 第二行包含N个数字,表示初始序列. 接下来M行,每行两个整数x,y (1<=x,y<=N),表示要交换的两个整数.在一次交换中,如果x和y相等,则不会改变序列的内容. 输出格式 输出N行,为交换后的序列中的数. 样例输

[官方软件] Easy Sysprep v4.3.29.602 【系统封装部署利器】(2016.01.22)--skyfree大神

[官方软件] Easy Sysprep v4.3.29.602 [系统封装部署利器](2016.01.22) Skyfree 发表于 2016-1-22 13:55:55 https://www.itsk.com/forum.php?mod=viewthread&tid=362766&highlight=Easy%2BSysprep [官方软件] Easy Sysprep v4.3.29.602 [系统封装部署利器](2016.01.22) [Easy Sysprep]概述:Easy Sy