1040水题;

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
 
#include<iostream>
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<cstring>
#include <algorithm> using namespace std; #define MAX 1005 bool cmp(int a,int b)
{
return a < b;
}
int main()
{
int t = 0;
int n = 1;
int a[MAX];
cin >> t;
while(t--)
{
memset(a,0,sizeof(a));
cin >> n;
for(int i = 0; i < n; i++)
{
cin >> a[i];
}
sort(a,a+n,cmp);
int temp = n-1;
for(int j = 0; j < n;j++)
{
if(temp--) cout << a[j] << " ";
else cout << a[j];
}
cout << endl;
}
return 0;
}

HDU排序水题的更多相关文章

  1. HDU-1042-N!(Java大法好 &amp;&amp; HDU大数水题)

    N! Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Subm ...

  2. PAT甲题题解-1012. The Best Rank (25)-排序水题

    排序,水题因为最后如果一个学生最好的排名有一样的,输出的课程有个优先级A>C>M>E那么按这个优先级顺序进行排序每次排序前先求当前课程的排名然后再与目前最好的排名比较.更新 至于查询 ...

  3. PAT甲题题解-1062. Talent and Virtue (25)-排序水题

    水题,分组排序即可. #include <iostream> #include <cstdio> #include <algorithm> #include < ...

  4. HDU 5391 水题。

    E - 5 Time Limit:1500MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Statu ...

  5. hdu 1544 水题

    水题 /* * Author : ben */ #include <cstdio> #include <cstdlib> #include <cstring> #i ...

  6. hdu 2710 水题

    题意:判断一些数里有最大因子的数 水题,省赛即将临近,高效的代码风格需要养成,为了简化代码,以后可能会更多的使用宏定义,但是通常也只是快速拿下第一道水题,涨自信.大部分的代码还是普通的形式,实际上能简 ...

  7. hdu 5427(排序水题)

    排序 年轻的排前面 名字中可能有空格 Sample Input21FancyCoder 19962FancyCoder 1996xyz111 1997 Sample OutputFancyCoderx ...

  8. hdu 5038 (2014北京网络赛G 排序水题)

    题意:有n个数字,带入10000 - (100 - ai) ^ 2公式得到n个数,输出n个数中频率最大的数,如果有并列就按值从小到大都输出输出,如果频率相同的数字是全部的n个数,就输出Bad....题 ...

  9. Dijkstra算法---HDU 2544 水题(模板)

    /* 对于只会弗洛伊德的我,迪杰斯特拉有点不是很理解,后来发现这主要用于单源最短路,稍稍明白了点,不过还是很菜,这里只是用了邻接矩阵 套模板,对于邻接表暂时还,,,没做题,后续再更新.现将这题贴上,应 ...

随机推荐

  1. win10桌面显示我的电脑设置

      首先,我们可以看到桌面上面没有我的电脑.   我们在桌面空白处点击右键,选择“个性化”.   然后选择“更改桌面图标”,如图示.   在如图示位置,将“计算机”勾选,然后点击“应用”--" ...

  2. 第二次项目冲刺(Beta版本)2017/12/10

    一.任务分布 二.燃尽图 三.站立式会议 1.照片(再给我两分钟) 2.任务安排 四.总结 冲刺的最后一天了,时间安排的不够好,还有部分功能没有完成,大家都尽力了,我们后续会抓紧时间完成项目.

  3. BBS论坛博客系统

    目录 BBS网站需求分析 BBS数据库设计 BBS用户登录 BBS用户注册 BBS网站首页 BBS个人首页 后台管理系统搭建 网站全部源码

  4. 【转】Android中通知的提示音、震动和LED灯效果小例子

    通知(Notification)是 Android 系统中比较有特色的一个功能,当某个应用程序希望向用户发出一些提示信息,而该应用程序又不在前台运行时,就可以借助通知来实现.发出一条通知后,手机最上方 ...

  5. shiro实战系列(十四)之配置

    Shiro 被设计成能够在任何环境下工作,从最简单的命令行应用程序到最大的的企业群集应用.由于环境的多样性,使得许多配置机制适用于它的配置. 一. 许多配置选项 Shiro的SecurityManag ...

  6. 高斯-克吕格投影与UTM投影

    高斯-克吕格投影与UTM投影 高斯-克吕格(Gauss-Kruger)投影与UTM投影(Universal Transverse Mercator,通用横轴墨卡托投影)都是横轴墨卡托投影的变种,目前一 ...

  7. OpenCV (C++) 几何形状识别(面积过滤、横纵比过滤等等)

    #include <opencv2/opencv.hpp> #include <iostream> #include <math.h> using namespac ...

  8. stm32 boot0 boot1的启动方式

    STM32三种启动模式对应的存储介质均是芯片内置的,它们是: 1)用户闪存 = 芯片内置的Flash. 2)SRAM = 芯片内置的RAM区,就是内存啦. 3)系统存储器 = 芯片内部一块特定的区域, ...

  9. MVC 拦截指定的action

    有时,我们需要在特定的一些aciton中做校验.比如:验证是否登录.实现方式有两种: 一.编写一个公共的方法专门用于实现是否登录的验证,然后在每个需要进行验证的aciton的头部去调用该方法,根据方法 ...

  10. c++ 模板参数做容器参数迭代器报错 vector<T>::const_iterator,typename const报错

    错误1: template<class T>void temp(std::vector<T>& container){        std::vector<T& ...