As Easy As A+B

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

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
 
 

//hdu-1040-As Easy As A+B
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 1100

int s[MAX];

int cmp(const void *a,const void *b)
{
    return *(int *)a - *(int *)b;
}

int main()
{
    int N;
    scanf("%d",&N);
    while(N--)
    {
        int i,m;
        memset(s,0,sizeof(s));
        scanf("%d",&m);
        for(i=0;i<m;i++)
        scanf("%d",&s[i]);
        qsort(s,m,sizeof(s[0]),cmp);
        for(i=0;i<m;i++)
        {
            if(i<m-1)
            printf("%d ",s[i]);
            else
            printf("%d\n",s[i]);
        }
    }
    return 0;
}

//简单题

最新文章

  1. Linq表达式、Lambda表达式你更喜欢哪个?
  2. 命名规范(数据库,c#)
  3. Xmanager远程Centos 7 Xfce
  4. 最近在 OS-10.9下配置opencv, cgal, latex, qt, pillow
  5. CheckBox和RadioButton
  6. multiple backgrounds 多重背景
  7. MyBatis之三:多表联合查询
  8. MQ 2035(MQRC_NOT_AUTHORIZED)
  9. hdu 5495 LCS
  10. Android学习笔记-EditText(输入框)(二)
  11. java容器类2:Map及HashMap深入解读
  12. 数据结构基础(2) --顺序查找 &amp; 二分查找
  13. 【SparkStreaming学习之三】 SparkStreaming和kafka整合
  14. mongodb group操作 以及管道 aggregate 分组排序分页
  15. iOS如何接收服务端返回的布尔值
  16. MyEclipse 黑色主题 jsp 页面 js背景色修改
  17. 开源软件License汇总
  18. Keras实现简单BP神经网络
  19. JavaScript unshift()怎样添加数据的?
  20. ZT 输入一个字符串,查找它的第一个数字串,并返回其个数

热门文章

  1. 【WIP】客户端JavaScript&#160;DOM
  2. [Apple开发者帐户帮助]八、管理档案(4)
  3. Sublime Text3 配置 Lua5.3.5开发环境
  4. vue-video-player视频播放插件
  5. 51nod1565 FFT
  6. 【洛谷2469/BZOJ1927】[SDOI2010]星际竞速(费用流/最小路径覆盖)
  7. MVC系列学习(十四)-路由规则及路由调试工具
  8. Struts之 拦截器配置 ( Interceptor )
  9. 【Java设计模式】工厂模式
  10. 亚马逊EC2构建代理服务器心血历程